(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "openttd.h"
|
|
|
|
#include "functions.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "table/sprites.h"
|
|
|
|
#include "variables.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "genworld.h"
|
|
|
|
#include "gfx.h"
|
|
|
|
#include "gfxinit.h"
|
|
|
|
#include "gui.h"
|
|
|
|
#include "network.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "heightmap.h"
|
2006-12-18 15:34:12 +00:00
|
|
|
#include "date.h"
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
|
|
|
void GenerateLandscape(byte mode);
|
|
|
|
void GenerateClearTile(void);
|
|
|
|
void GenerateIndustries(void);
|
|
|
|
void GenerateUnmovables(void);
|
|
|
|
bool GenerateTowns(void);
|
|
|
|
void GenerateTrees(void);
|
|
|
|
|
|
|
|
void StartupEconomy(void);
|
|
|
|
void StartupPlayers(void);
|
|
|
|
void StartupDisasters(void);
|
|
|
|
|
|
|
|
void InitializeGame(int mode, uint size_x, uint size_y);
|
|
|
|
|
|
|
|
void ConvertGroundTilesIntoWaterTiles(void);
|
|
|
|
|
|
|
|
/* Please only use this variable in genworld.h and genworld.c and
|
|
|
|
* nowhere else. For speed improvements we need it to be global, but
|
|
|
|
* in no way the meaning of it is to use it anywhere else besides
|
|
|
|
* in the genworld.h and genworld.c! -- TrueLight */
|
|
|
|
gw_info _gw;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the status of the Paint flag.
|
|
|
|
* If it is true, the thread will hold with any futher generating till
|
|
|
|
* the drawing of the screen is done. This is handled by
|
|
|
|
* SetGeneratingWorldProgress(), so calling that function will stall
|
|
|
|
* from time to time.
|
|
|
|
*/
|
|
|
|
void SetGeneratingWorldPaintStatus(bool status)
|
|
|
|
{
|
|
|
|
_gw.wait_for_draw = status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the thread wants the main program to do a (full) paint.
|
|
|
|
* If this returns false, please do not update the screen. Because we are
|
|
|
|
* writing in a thread, it can cause damaged data (reading and writing the
|
|
|
|
* same tile at the same time).
|
|
|
|
*/
|
|
|
|
bool IsGeneratingWorldReadyForPaint(void)
|
|
|
|
{
|
|
|
|
/* If we are in quit_thread mode, ignore this and always return false. This
|
|
|
|
* forces the screen to not be drawn, and the GUI not to wait for a draw. */
|
|
|
|
if (!_gw.active || _gw.quit_thread || !_gw.threaded) return false;
|
|
|
|
|
|
|
|
return _gw.wait_for_draw;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tells if the world generation is done in a thread or not.
|
|
|
|
*/
|
|
|
|
bool IsGenerateWorldThreaded(void)
|
|
|
|
{
|
|
|
|
return _gw.threaded && !_gw.quit_thread;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The internal, real, generate function.
|
|
|
|
*/
|
|
|
|
static void *_GenerateWorld(void *arg)
|
|
|
|
{
|
|
|
|
_generating_world = true;
|
2006-12-26 17:36:18 +00:00
|
|
|
if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait...");
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
|
|
|
|
if (_patches.generation_seed == GENERATE_NEW_SEED) _patches.generation_seed = _patches_newgame.generation_seed = InteractiveRandom();
|
|
|
|
_random_seeds[0][0] = _random_seeds[0][1] = _patches.generation_seed;
|
|
|
|
SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
|
|
|
|
SetObjectToPlace(SPR_CURSOR_ZZZ, 0, 0, 0);
|
|
|
|
|
|
|
|
IncreaseGeneratingWorldProgress(GWP_MAP_INIT);
|
|
|
|
// Must start economy early because of the costs.
|
|
|
|
StartupEconomy();
|
|
|
|
|
|
|
|
// Don't generate landscape items when in the scenario editor.
|
|
|
|
if (_gw.mode == GW_EMPTY) {
|
|
|
|
SetGeneratingWorldProgress(GWP_UNMOVABLE, 1);
|
|
|
|
|
|
|
|
/* Make the map the height of the patch setting */
|
|
|
|
if (_game_mode != GM_MENU) FlatEmptyWorld(_patches.se_flat_world_height);
|
|
|
|
|
|
|
|
ConvertGroundTilesIntoWaterTiles();
|
|
|
|
IncreaseGeneratingWorldProgress(GWP_UNMOVABLE);
|
|
|
|
} else {
|
|
|
|
GenerateLandscape(_gw.mode);
|
|
|
|
GenerateClearTile();
|
|
|
|
|
|
|
|
// only generate towns, tree and industries in newgame mode.
|
|
|
|
if (_game_mode != GM_EDITOR) {
|
|
|
|
GenerateTowns();
|
|
|
|
GenerateIndustries();
|
|
|
|
GenerateUnmovables();
|
|
|
|
GenerateTrees();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// These are probably pointless when inside the scenario editor.
|
|
|
|
SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
|
|
|
|
StartupPlayers();
|
|
|
|
IncreaseGeneratingWorldProgress(GWP_GAME_INIT);
|
|
|
|
StartupEngines();
|
|
|
|
IncreaseGeneratingWorldProgress(GWP_GAME_INIT);
|
|
|
|
StartupDisasters();
|
|
|
|
_generating_world = false;
|
|
|
|
|
|
|
|
// No need to run the tile loop in the scenario editor.
|
|
|
|
if (_gw.mode != GW_EMPTY) {
|
|
|
|
uint i;
|
|
|
|
|
|
|
|
SetGeneratingWorldProgress(GWP_RUNTILELOOP, 0x500);
|
|
|
|
for (i = 0; i < 0x500; i++) {
|
|
|
|
RunTileLoop();
|
|
|
|
IncreaseGeneratingWorldProgress(GWP_RUNTILELOOP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ResetObjectToPlace();
|
2006-12-26 12:56:48 +00:00
|
|
|
SetLocalPlayer(_gw.lp);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
|
|
|
SetGeneratingWorldProgress(GWP_GAME_START, 1);
|
|
|
|
/* Call any callback */
|
|
|
|
if (_gw.proc != NULL) _gw.proc();
|
|
|
|
IncreaseGeneratingWorldProgress(GWP_GAME_START);
|
|
|
|
|
|
|
|
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE);
|
|
|
|
/* Show all vital windows again, because we have hidden them */
|
2006-08-19 12:01:04 +00:00
|
|
|
if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
_gw.active = false;
|
|
|
|
_gw.thread = NULL;
|
|
|
|
_gw.proc = NULL;
|
|
|
|
_gw.threaded = false;
|
|
|
|
|
|
|
|
DeleteWindowById(WC_GENERATE_PROGRESS_WINDOW, 0);
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
|
2006-12-26 17:36:18 +00:00
|
|
|
if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set here the function, if any, that you want to be called when landscape
|
|
|
|
* generation is done.
|
|
|
|
*/
|
|
|
|
void GenerateWorldSetCallback(gw_done_proc *proc)
|
|
|
|
{
|
|
|
|
_gw.proc = proc;
|
|
|
|
}
|
|
|
|
|
2006-11-22 14:14:02 +00:00
|
|
|
/**
|
|
|
|
* Set here the function, if any, that you want to be called when landscape
|
|
|
|
* generation is aborted.
|
|
|
|
*/
|
|
|
|
void GenerateWorldSetAbortCallback(gw_abort_proc *proc)
|
|
|
|
{
|
|
|
|
_gw.abortp = proc;
|
|
|
|
}
|
|
|
|
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/**
|
|
|
|
* This will wait for the thread to finish up his work. It will not continue
|
|
|
|
* till the work is done.
|
|
|
|
*/
|
|
|
|
void WaitTillGeneratedWorld(void)
|
|
|
|
{
|
|
|
|
if (_gw.thread == NULL) return;
|
|
|
|
_gw.quit_thread = true;
|
|
|
|
OTTDJoinThread(_gw.thread);
|
|
|
|
_gw.thread = NULL;
|
|
|
|
_gw.threaded = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the abortion process
|
|
|
|
*/
|
|
|
|
void AbortGeneratingWorld(void)
|
|
|
|
{
|
|
|
|
_gw.abort = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is the generation being aborted?
|
|
|
|
*/
|
|
|
|
bool IsGeneratingWorldAborted(void)
|
|
|
|
{
|
|
|
|
return _gw.abort;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Really handle the abortion, i.e. clean up some of the mess
|
|
|
|
*/
|
|
|
|
void HandleGeneratingWorldAbortion(void)
|
|
|
|
{
|
|
|
|
/* Clean up - in SE create an empty map, otherwise, go to intro menu */
|
|
|
|
_switch_mode = (_game_mode == GM_EDITOR) ? SM_EDITOR : SM_MENU;
|
|
|
|
|
2006-11-22 14:14:02 +00:00
|
|
|
if (_gw.abortp != NULL) _gw.abortp();
|
|
|
|
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE);
|
|
|
|
/* Show all vital windows again, because we have hidden them */
|
2006-08-19 12:01:04 +00:00
|
|
|
if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
_gw.active = false;
|
|
|
|
_gw.thread = NULL;
|
|
|
|
_gw.proc = NULL;
|
2006-11-22 14:14:02 +00:00
|
|
|
_gw.abortp = NULL;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
_gw.threaded = false;
|
|
|
|
|
|
|
|
DeleteWindowById(WC_GENERATE_PROGRESS_WINDOW, 0);
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
|
|
|
|
OTTDExitThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate a world.
|
|
|
|
* @param mode The mode of world generation (@see GenerateWorldModes).
|
|
|
|
* @param size_x The X-size of the map.
|
|
|
|
* @param size_y The Y-size of the map.
|
|
|
|
*/
|
|
|
|
void GenerateWorld(int mode, uint size_x, uint size_y)
|
|
|
|
{
|
|
|
|
if (_gw.active) return;
|
|
|
|
_gw.mode = mode;
|
|
|
|
_gw.size_x = size_x;
|
|
|
|
_gw.size_y = size_y;
|
|
|
|
_gw.active = true;
|
|
|
|
_gw.abort = false;
|
2006-11-22 14:14:02 +00:00
|
|
|
_gw.abortp = NULL;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
_gw.lp = _local_player;
|
|
|
|
_gw.wait_for_draw = false;
|
|
|
|
_gw.quit_thread = false;
|
|
|
|
_gw.threaded = true;
|
|
|
|
|
|
|
|
/* This disables some commands and stuff */
|
2006-12-26 12:56:48 +00:00
|
|
|
SetLocalPlayer(PLAYER_SPECTATOR);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/* Make sure everything is done via OWNER_NONE */
|
|
|
|
_current_player = OWNER_NONE;
|
|
|
|
|
2006-12-18 15:34:12 +00:00
|
|
|
/* Set the date before loading sprites as some newgrfs check it */
|
|
|
|
SetDate(ConvertYMDToDate(_patches.starting_year, 0, 1));
|
|
|
|
|
2006-11-24 18:39:22 +00:00
|
|
|
/* Load the right landscape stuff */
|
|
|
|
GfxLoadSprites();
|
|
|
|
LoadStringWidthTable();
|
|
|
|
|
2006-12-18 15:34:12 +00:00
|
|
|
InitializeGame(IG_NONE, _gw.size_x, _gw.size_y);
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
PrepareGenerateWorldProgress();
|
|
|
|
|
|
|
|
/* Re-init the windowing system */
|
|
|
|
ResetWindowSystem();
|
|
|
|
|
|
|
|
/* Create toolbars */
|
|
|
|
SetupColorsAndInitialWindow();
|
|
|
|
|
2006-11-07 14:41:53 +00:00
|
|
|
if (_network_dedicated ||
|
|
|
|
(_gw.thread = OTTDCreateThread(&_GenerateWorld, NULL)) == NULL) {
|
2006-12-26 17:36:18 +00:00
|
|
|
DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode");
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
_gw.threaded = false;
|
|
|
|
_GenerateWorld(NULL);
|
2006-11-07 14:41:53 +00:00
|
|
|
return;
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
}
|
|
|
|
|
2006-11-07 14:41:53 +00:00
|
|
|
/* Remove any open window */
|
|
|
|
DeleteAllNonVitalWindows();
|
2006-11-07 13:06:02 +00:00
|
|
|
/* Hide vital windows, because we don't allow to use them */
|
2006-11-07 14:41:53 +00:00
|
|
|
HideVitalWindows();
|
|
|
|
|
|
|
|
/* Don't show the dialog if we don't have a thread */
|
|
|
|
ShowGenerateWorldProgress();
|
2006-11-07 13:06:02 +00:00
|
|
|
|
|
|
|
/* Centre the view on the map */
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) {
|
|
|
|
ScrollMainWindowToTile(TileXY(MapSizeX() / 2, MapSizeY() / 2));
|
|
|
|
}
|
|
|
|
}
|