#include "company_type.h"
Go to the source code of this file.
Data Structures | |
struct | gw_info |
Typedefs | |
typedef void | gw_done_proc () |
typedef void | gw_abort_proc () |
Enumerations | |
enum | { LG_ORIGINAL = 0, LG_TERRAGENESIS = 1, GENERATE_NEW_SEED = UINT_MAX } |
enum | GenerateWorldMode { GW_NEWGAME = 0, GW_EMPTY = 1, GW_RANDOM = 2, GW_HEIGHTMAP = 3 } |
enum | gwp_class { GWP_MAP_INIT, GWP_LANDSCAPE, GWP_ROUGH_ROCKY, GWP_TOWN, GWP_INDUSTRY, GWP_UNMOVABLE, GWP_TREE, GWP_GAME_INIT, GWP_RUNTILELOOP, GWP_GAME_START, GWP_CLASS_COUNT } |
Functions | |
static bool | IsGeneratingWorld () |
Check if we are currently in the process of generating a world. | |
void | SetGeneratingWorldPaintStatus (bool status) |
Set the status of the Paint flag. | |
bool | IsGeneratingWorldReadyForPaint () |
Returns true if the thread wants the main program to do a (full) paint. | |
bool | IsGenerateWorldThreaded () |
Tells if the world generation is done in a thread or not. | |
void | GenerateWorldSetCallback (gw_done_proc *proc) |
Set here the function, if any, that you want to be called when landscape generation is done. | |
void | GenerateWorldSetAbortCallback (gw_abort_proc *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 (GenerateWorldMode mode, uint size_x, uint size_y) |
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 | SetGeneratingWorldProgress (gwp_class cls, uint total) |
Set the total of a stage of the world generation. | |
void | IncreaseGeneratingWorldProgress (gwp_class 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) |
void | ShowCreateScenario () |
void | StartScenarioEditor () |
Definition in file genworld.h.
anonymous enum |
LG_ORIGINAL | The original landscape generator. |
LG_TERRAGENESIS | TerraGenesis Perlin landscape generator. |
GENERATE_NEW_SEED | Create a new random seed. |
Definition at line 14 of file genworld.h.
enum gwp_class |
Definition at line 47 of file genworld.h.
void GenerateWorld | ( | GenerateWorldMode | mode, | |
uint | size_x, | |||
uint | size_y | |||
) |
Generate a world.
mode | The mode of world generation (see GenerateWorldModes). | |
size_x | The X-size of the map. | |
size_y | The Y-size of the map. |
Definition at line 265 of file genworld.cpp.
References _GenerateWorld(), _settings_game, COMPANY_SPECTATOR, ConvertYMDToDate(), DeleteAllNonVitalWindows(), FindWindowById(), GameSettings::game_creation, BlitterFactoryBase::GetCurrentBlitter(), HideVitalWindows(), LoadStringWidthTable(), MapSizeX(), MapSizeY(), ThreadObject::New(), OWNER_NONE, PrepareGenerateWorldProgress(), ResetWindowSystem(), SetLocalCompany(), ShowGenerateWorldProgress(), GameCreationSettings::starting_year, and TileXY().
void HandleGeneratingWorldAbortion | ( | ) |
Really handle the abortion, i.e.
clean up some of the mess
Definition at line 237 of file genworld.cpp.
References DeleteWindowById(), MarkWholeScreenDirty(), and CursorVars::sprite.
void IncreaseGeneratingWorldProgress | ( | gwp_class | cls | ) |
Increases the current stage of the world generation with one.
cls | the current class we are in. |
Definition at line 1090 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), GenerateTerrainPerlin(), PlaceInitialIndustry(), and PlaceTreesRandomly().
bool IsGeneratingWorldReadyForPaint | ( | ) |
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).
Definition at line 68 of file genworld.cpp.
Referenced by DrawDirtyBlocks().
void SetGeneratingWorldPaintStatus | ( | bool | status | ) |
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.
Definition at line 57 of file genworld.cpp.
Referenced by DrawDirtyBlocks().
void SetGeneratingWorldProgress | ( | gwp_class | 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. |
Definition at line 1076 of file genworld_gui.cpp.
Referenced by _GenerateWorld(), GenerateIndustries(), and GenerateTrees().
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 208 of file genworld.cpp.