Functions related to world/map generation. More...
#include "company_type.h"Go to the source code of this file.
Data Structures | |
| struct | GenWorldInfo |
| Properties of current genworld process. More... | |
Typedefs | |
| typedef void | GWDoneProc () |
| Procedure called when the genworld process finishes. | |
| typedef void | GWAbortProc () |
| Called when genworld is aborted. | |
Enumerations | |
| enum | LandscapeGenerator { LG_ORIGINAL = 0, LG_TERRAGENESIS = 1 } |
Constants related to world generation. More... | |
| enum | GenWorldMode { GWM_NEWGAME = 0, GWM_EMPTY = 1, GWM_RANDOM = 2, GWM_HEIGHTMAP = 3 } |
Modes for GenerateWorld. More... | |
| enum | GenWorldProgress { GWP_MAP_INIT, GWP_LANDSCAPE, GWP_RIVER, GWP_ROUGH_ROCKY, GWP_TOWN, GWP_INDUSTRY, GWP_OBJECT, GWP_TREE, GWP_GAME_INIT, GWP_RUNTILELOOP, GWP_RUNSCRIPT, GWP_GAME_START, GWP_CLASS_COUNT } |
Current stage of world generation process. More... | |
Functions | |
| bool | IsGenerateWorldThreaded () |
| Tells if the world generation is done in a thread or not. | |
| void | GenerateWorldSetCallback (GWDoneProc *proc) |
| Set here the function, if any, that you want to be called when landscape generation is done. | |
| void | GenerateWorldSetAbortCallback (GWAbortProc *proc) |
| Set here the function, if any, that you want to be called when landscape generation is aborted. | |
| void | WaitTillGeneratedWorld () |
| This will wait for the thread to finish up his work. | |
| void | GenerateWorld (GenWorldMode mode, uint size_x, uint size_y, bool reset_settings=true) |
| Generate a world. | |
| void | AbortGeneratingWorld () |
| Initializes the abortion process. | |
| bool | IsGeneratingWorldAborted () |
| Is the generation being aborted? | |
| void | HandleGeneratingWorldAbortion () |
| Really handle the abortion, i.e. | |
| void | SetNewLandscapeType (byte landscape) |
| Changes landscape type and sets genworld window dirty. | |
| void | SetGeneratingWorldProgress (GenWorldProgress cls, uint total) |
| Set the total of a stage of the world generation. | |
| void | IncreaseGeneratingWorldProgress (GenWorldProgress cls) |
| Increases the current stage of the world generation with one. | |
| void | PrepareGenerateWorldProgress () |
| Initializes the progress counters to the starting point. | |
| void | ShowGenerateWorldProgress () |
| Show the window where a user can follow the process of the map generation. | |
| void | StartNewGameWithoutGUI (uint seed) |
| Start a normal game without the GUI. | |
| void | ShowCreateScenario () |
| Show the window to create a scenario. | |
| void | StartScenarioEditor () |
| Start with a scenario editor. | |
Variables | |
| static const uint | GENERATE_NEW_SEED = UINT_MAX |
| Create a new random seed. | |
| static const uint | CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY = 4 |
| Value for custom sea level in difficulty settings. | |
| static const uint | CUSTOM_SEA_LEVEL_MIN_PERCENTAGE = 1 |
| Minimum percentage a user can specify for custom sea level. | |
| static const uint | CUSTOM_SEA_LEVEL_MAX_PERCENTAGE = 90 |
| Maximum percentage a user can specify for custom sea level. | |
| bool | _generating_world |
| Whether we are generating the map or not. | |
Functions related to world/map generation.
Definition in file genworld.h.
| enum GenWorldMode |
Modes for GenerateWorld.
| GWM_NEWGAME |
Generate a map for a new game. |
| GWM_EMPTY |
Generate an empty map (sea-level). |
| GWM_RANDOM |
Generate a random map for SE. |
| GWM_HEIGHTMAP |
Generate a newgame from a heightmap. |
Definition at line 28 of file genworld.h.
| enum GenWorldProgress |
Current stage of world generation process.
Definition at line 57 of file genworld.h.
| enum LandscapeGenerator |
Constants related to world generation.
| LG_ORIGINAL |
The original landscape generator. |
| LG_TERRAGENESIS |
TerraGenesis Perlin landscape generator. |
Definition at line 18 of file genworld.h.
| void GenerateWorld | ( | GenWorldMode | mode, | |
| uint | size_x, | |||
| uint | size_y, | |||
| bool | reset_settings | |||
| ) |
Generate a world.
| mode | The mode of world generation (see GenWorldMode). | |
| size_x | The X-size of the map. | |
| size_y | The Y-size of the map. | |
| reset_settings | Whether to reset the game configuration (used for restart) |
Definition at line 291 of file genworld.cpp.
References _GenerateWorld(), _local_company, _modal_progress_work_mutex, _video_driver, GenWorldInfo::abort, GenWorldInfo::abortp, ThreadMutex::BeginCritical(), COMPANY_SPECTATOR, DEBUG, DeleteAllNonVitalWindows(), ThreadMutex::EndCritical(), FindWindowById(), GfxLoadSprites(), VideoDriver::HasGUI(), HasModalProgress(), HideVitalWindows(), HT_NONE, ThreadObject::Join(), GenWorldInfo::lc, LoadStringWidthTable(), MapSizeX(), MapSizeY(), GenWorldInfo::mode, ThreadObject::New(), PrepareGenerateWorldProgress(), GenWorldInfo::quit_thread, ResetWindowSystem(), ScrollMainWindowToTile(), SetLocalCompany(), SetModalProgress(), SetupColoursAndInitialWindow(), ShowGenerateWorldProgress(), GenWorldInfo::size_x, GenWorldInfo::size_y, GenWorldInfo::thread, GenWorldInfo::threaded, TileXY(), UnshowCriticalError(), and WC_MAIN_WINDOW.
Referenced by LoadIntroGame().
| void GenerateWorldSetAbortCallback | ( | GWAbortProc * | proc | ) |
Set here the function, if any, that you want to be called when landscape generation is aborted.
| proc | callback procedure |
Definition at line 226 of file genworld.cpp.
References GenWorldInfo::abortp.
Referenced by GenerateTerrainPerlin().
| void GenerateWorldSetCallback | ( | GWDoneProc * | proc | ) |
Set here the function, if any, that you want to be called when landscape generation is done.
| proc | callback procedure |
Definition at line 216 of file genworld.cpp.
References GenWorldInfo::proc.
| void HandleGeneratingWorldAbortion | ( | ) |
Really handle the abortion, i.e.
clean up some of the mess
Definition at line 270 of file genworld.cpp.
References _switch_mode, GenWorldInfo::abortp, CleanupGeneration(), ThreadObject::Exit(), SM_EDITOR, SM_MENU, and GenWorldInfo::thread.
Referenced by _GenerateWorld().
| void IncreaseGeneratingWorldProgress | ( | GenWorldProgress | cls | ) |
Increases the current stage of the world generation with one.
| cls | the current class we are in. |
Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always. Also, progress works if total is zero, total works if progress is zero.
Definition at line 1355 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), CreateRivers(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateTowns(), PlaceInitialIndustry(), PlaceTreeGroups(), and PlaceTreesRandomly().
| bool IsGenerateWorldThreaded | ( | ) |
Tells if the world generation is done in a thread or not.
Definition at line 64 of file genworld.cpp.
References GenWorldInfo::quit_thread, and GenWorldInfo::threaded.
| bool IsGeneratingWorldAborted | ( | ) |
Is the generation being aborted?
Definition at line 262 of file genworld.cpp.
References GenWorldInfo::abort.
| void SetGeneratingWorldProgress | ( | GenWorldProgress | cls, | |
| uint | total | |||
| ) |
Set the total of a stage of the world generation.
| cls | the current class we are in. | |
| total | Set the total expected items for this class. |
Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always. Also, progress works if total is zero, total works if progress is zero.
Definition at line 1341 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), CreateRivers(), GenerateIndustries(), GenerateLandscape(), GenerateTowns(), and GenerateTrees().
| void SetNewLandscapeType | ( | byte | landscape | ) |
Changes landscape type and sets genworld window dirty.
| landscape | new landscape type |
Definition at line 49 of file genworld_gui.cpp.
References _settings_newgame, GameSettings::game_creation, InvalidateWindowClassesData(), GameCreationSettings::landscape, WC_GENERATE_LANDSCAPE, and WC_SELECT_GAME.
Referenced by SelectGameWindow::OnClick(), and CreateScenarioWindow::OnClick().
| void ShowCreateScenario | ( | ) |
Show the window to create a scenario.
Definition at line 1121 of file genworld_gui.cpp.
References DeleteWindowByClass(), GLWM_SCENARIO, and WC_GENERATE_LANDSCAPE.
Referenced by ScenarioEditorLandscapeGenerationWindow::OnClick().
| void StartNewGameWithoutGUI | ( | uint | seed | ) |
Start a normal game without the GUI.
| seed | The seed of the new game. |
Definition at line 874 of file genworld_gui.cpp.
References _settings_newgame, GameSettings::game_creation, GameCreationSettings::generation_seed, and GLWM_GENERATE.
Referenced by VideoDriver_Dedicated::MainLoop(), NetworkCheckRestartMap(), and SelectGameWindow::OnClick().
| void StartScenarioEditor | ( | ) |
Start with a scenario editor.
Definition at line 865 of file genworld_gui.cpp.
References GLWM_SCENARIO.
Referenced by SelectGameWindow::OnClick().
| void WaitTillGeneratedWorld | ( | ) |
This will wait for the thread to finish up his work.
It will not continue till the work is done.
Definition at line 235 of file genworld.cpp.
References _modal_progress_paint_mutex, _modal_progress_work_mutex, ThreadMutex::BeginCritical(), ThreadMutex::EndCritical(), ThreadObject::Join(), GenWorldInfo::quit_thread, GenWorldInfo::thread, and GenWorldInfo::threaded.
Referenced by LoadIntroGame().
| bool _generating_world |
Whether we are generating the map or not.
Definition at line 58 of file genworld.cpp.
Referenced by _GenerateWorld(), BuildTownHouse(), CheckIfIndustryTilesAreFree(), CleanupGeneration(), ClosestTownFromTile(), CmdDeleteTown(), CmdFoundTown(), CmdTerraformLand(), CreateNewIndustryHelper(), DoCommandP(), DoCommandPInternal(), DoCreateNewIndustry(), GenerateDesertArea(), GenerateTownName(), GetTerrainType(), GrowTown(), GrowTownInTile(), HasRoadTypesAvail(), HouseGetVariable(), InitializeGRFSpecial(), IsRoadAllowedHere(), BuildIndustryWindow::OnClick(), BuildIndustryWindow::OnPlaceObject(), ResetLandscapeConfirmationCallback(), TownLayoutAllows2x2HouseHere(), TownLayoutAllowsHouseHere(), and UpdateNearestTownForRoadTiles().
1.7.1