OpenTTD

genworld.cpp
Go to the documentation of this file.
1 /* $Id: genworld.cpp 27670 2016-10-30 17:29:33Z frosch $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #include "stdafx.h"
13 #include "landscape.h"
14 #include "company_func.h"
15 #include "genworld.h"
16 #include "gfxinit.h"
17 #include "window_func.h"
18 #include "network/network.h"
19 #include "heightmap.h"
20 #include "viewport_func.h"
21 #include "date_func.h"
22 #include "engine_func.h"
23 #include "water.h"
24 #include "video/video_driver.hpp"
25 #include "tilehighlight_func.h"
26 #include "saveload/saveload.h"
27 #include "void_map.h"
28 #include "town.h"
29 #include "newgrf.h"
30 #include "core/random_func.hpp"
31 #include "core/backup_type.hpp"
32 #include "progress.h"
33 #include "error.h"
34 #include "game/game.hpp"
35 #include "game/game_instance.hpp"
36 #include "string_func.h"
37
38 #include "safeguards.h"
39
40
41 void GenerateClearTile();
42 void GenerateIndustries();
43 void GenerateObjects();
44 void GenerateTrees();
45
46 void StartupEconomy();
47 void StartupCompanies();
48 void StartupDisasters();
49
50 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings);
51
58 GenWorldInfo _gw;
59
61 bool _generating_world;
62
67 bool IsGenerateWorldThreaded()
68 {
69 return _gw.threaded && !_gw.quit_thread;
70 }
71
76 static void CleanupGeneration()
77 {
78 _generating_world = false;
79
80 SetMouseCursorBusy(false);
81 /* Show all vital windows again, because we have hidden them */
82 if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
83 SetModalProgress(false);
84 _gw.proc = NULL;
85 _gw.abortp = NULL;
86 _gw.threaded = false;
87
88 DeleteWindowByClass(WC_MODAL_PROGRESS);
89 ShowFirstError();
90 MarkWholeScreenDirty();
91 }
92
96 static void _GenerateWorld(void *)
97 {
98 /* Make sure everything is done via OWNER_NONE. */
99 Backup<CompanyByte> _cur_company(_current_company, OWNER_NONE, FILE_LINE);
100
101 try {
102 _generating_world = true;
103 _modal_progress_work_mutex->BeginCritical();
104 if (_network_dedicated) DEBUG(net, 1, "Generating map, please wait...");
105 /* Set the Random() seed to generation_seed so we produce the same map with the same seed */
106 if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
107 _random.SetSeed(_settings_game.game_creation.generation_seed);
108 SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
109 SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
110
111 BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
112
113 IncreaseGeneratingWorldProgress(GWP_MAP_INIT);
114 /* Must start economy early because of the costs. */
115 StartupEconomy();
116
117 /* Don't generate landscape items when in the scenario editor. */
118 if (_gw.mode == GWM_EMPTY) {
119 SetGeneratingWorldProgress(GWP_OBJECT, 1);
120
121 /* Make sure the tiles at the north border are void tiles if needed. */
122 if (_settings_game.construction.freeform_edges) {
123 for (uint row = 0; row < MapSizeY(); row++) MakeVoid(TileXY(0, row));
124 for (uint col = 0; col < MapSizeX(); col++) MakeVoid(TileXY(col, 0));
125 }
126
127 /* Make the map the height of the setting */
128 if (_game_mode != GM_MENU) FlatEmptyWorld(_settings_game.game_creation.se_flat_world_height);
129
130 ConvertGroundTilesIntoWaterTiles();
131 IncreaseGeneratingWorldProgress(GWP_OBJECT);
132 } else {
133 GenerateLandscape(_gw.mode);
134 GenerateClearTile();
135
136 /* only generate towns, tree and industries in newgame mode. */
137 if (_game_mode != GM_EDITOR) {
138 if (!GenerateTowns(_settings_game.economy.town_layout)) {
139 _cur_company.Restore();
140 HandleGeneratingWorldAbortion();
141 return;
142 }
143 GenerateIndustries();
144 GenerateObjects();
145 GenerateTrees();
146 }
147 }
148
149 /* These are probably pointless when inside the scenario editor. */
150 SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
151 StartupCompanies();
152 IncreaseGeneratingWorldProgress(GWP_GAME_INIT);
153 StartupEngines();
154 IncreaseGeneratingWorldProgress(GWP_GAME_INIT);
155 StartupDisasters();
156 _generating_world = false;
157
158 /* No need to run the tile loop in the scenario editor. */
159 if (_gw.mode != GWM_EMPTY) {
160 uint i;
161
162 SetGeneratingWorldProgress(GWP_RUNTILELOOP, 0x500);
163 for (i = 0; i < 0x500; i++) {
164 RunTileLoop();
165 _tick_counter++;
166 IncreaseGeneratingWorldProgress(GWP_RUNTILELOOP);
167 }
168
169 if (_game_mode != GM_EDITOR) {
170 Game::StartNew();
171
172 if (Game::GetInstance() != NULL) {
173 SetGeneratingWorldProgress(GWP_RUNSCRIPT, 2500);
174 _generating_world = true;
175 for (i = 0; i < 2500; i++) {
176 Game::GameLoop();
177 IncreaseGeneratingWorldProgress(GWP_RUNSCRIPT);
178 if (Game::GetInstance()->IsSleeping()) break;
179 }
180 _generating_world = false;
181 }
182 }
183 }
184
185 BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);
186
187 ResetObjectToPlace();
188 _cur_company.Trash();
189 _current_company = _local_company = _gw.lc;
190
191 SetGeneratingWorldProgress(GWP_GAME_START, 1);
192 /* Call any callback */
193 if (_gw.proc != NULL) _gw.proc();
194 IncreaseGeneratingWorldProgress(GWP_GAME_START);
195
196 CleanupGeneration();
197 _modal_progress_work_mutex->EndCritical();
198
199 ShowNewGRFError();
200
201 if (_network_dedicated) DEBUG(net, 1, "Map generated, starting game");
202 DEBUG(desync, 1, "new_map: %08x", _settings_game.game_creation.generation_seed);
203
204 if (_debug_desync_level > 0) {
205 char name[MAX_PATH];
206 seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date);
207 SaveOrLoad(name, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
208 }
209 } catch (...) {
210 BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP, true);
211 if (_cur_company.IsValid()) _cur_company.Restore();
212 _generating_world = false;
213 _modal_progress_work_mutex->EndCritical();
214 throw;
215 }
216 }
217
223 void GenerateWorldSetCallback(GWDoneProc *proc)
224 {
225 _gw.proc = proc;
226 }
227
233 void GenerateWorldSetAbortCallback(GWAbortProc *proc)
234 {
235 _gw.abortp = proc;
236 }
237
242 void WaitTillGeneratedWorld()
243 {
244 if (_gw.thread == NULL) return;
245
246 _modal_progress_work_mutex->EndCritical();
247 _modal_progress_paint_mutex->EndCritical();
248 _gw.quit_thread = true;
249 _gw.thread->Join();
250 delete _gw.thread;
251 _gw.thread = NULL;
252 _gw.threaded = false;
253 _modal_progress_work_mutex->BeginCritical();
254 _modal_progress_paint_mutex->BeginCritical();
255 }
256
260 void AbortGeneratingWorld()
261 {
262 _gw.abort = true;
263 }
264
269 bool IsGeneratingWorldAborted()
270 {
271 return _gw.abort;
272 }
273
277 void HandleGeneratingWorldAbortion()
278 {
279 /* Clean up - in SE create an empty map, otherwise, go to intro menu */
280 _switch_mode = (_game_mode == GM_EDITOR) ? SM_EDITOR : SM_MENU;
281
282 if (_gw.abortp != NULL) _gw.abortp();
283
284 CleanupGeneration();
285
286 if (_gw.thread != NULL) _gw.thread->Exit();
287
288 SwitchToMode(_switch_mode);
289 }
290
298 void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings)
299 {
300 if (HasModalProgress()) return;
301 _gw.mode = mode;
302 _gw.size_x = size_x;
303 _gw.size_y = size_y;
304 SetModalProgress(true);
305 _gw.abort = false;
306 _gw.abortp = NULL;
307 _gw.lc = _local_company;
308 _gw.quit_thread = false;
309 _gw.threaded = true;
310
311 /* This disables some commands and stuff */
312 SetLocalCompany(COMPANY_SPECTATOR);
313
314 InitializeGame(_gw.size_x, _gw.size_y, true, reset_settings);
315 PrepareGenerateWorldProgress();
316
317 /* Load the right landscape stuff, and the NewGRFs! */
318 GfxLoadSprites();
319 LoadStringWidthTable();
320
321 /* Re-init the windowing system */
322 ResetWindowSystem();
323
324 /* Create toolbars */
325 SetupColoursAndInitialWindow();
326 SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
327
328 if (_gw.thread != NULL) {
329 _gw.thread->Join();
330 delete _gw.thread;
331 _gw.thread = NULL;
332 }
333
334 if (!VideoDriver::GetInstance()->HasGUI() || !ThreadObject::New(&_GenerateWorld, NULL, &_gw.thread, "ottd:genworld")) {
335 DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode");
336 _gw.threaded = false;
337 _modal_progress_work_mutex->EndCritical();
338 _GenerateWorld(NULL);
339 _modal_progress_work_mutex->BeginCritical();
340 return;
341 }
342
343 UnshowCriticalError();
344 /* Remove any open window */
345 DeleteAllNonVitalWindows();
346 /* Hide vital windows, because we don't allow to use them */
347 HideVitalWindows();
348
349 /* Don't show the dialog if we don't have a thread */
350 ShowGenerateWorldProgress();
351
352 /* Centre the view on the map */
353 if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) {
354 ScrollMainWindowToTile(TileXY(MapSizeX() / 2, MapSizeY() / 2), true);
355 }
356 }
SetupColoursAndInitialWindow
void SetupColoursAndInitialWindow()
Initialise the default colours (remaps and the likes), and load the main windows. ...
Definition: main_gui.cpp:549
GenerateIndustries
void GenerateIndustries()
This function will create random industries during game creation.
Definition: industry_cmd.cpp:2116
PrepareGenerateWorldProgress
void PrepareGenerateWorldProgress()
Initializes the progress counters to the starting point.
Definition: genworld_gui.cpp:1252
MapSizeX
static uint MapSizeX()
Get the size of the map along the X.
Definition: map_func.h:74
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:77
video_driver.hpp
Base of all video drivers.
MapSizeY
static uint MapSizeY()
Get the size of the map along the Y.
Definition: map_func.h:84
MakeVoid
static void MakeVoid(TileIndex t)
Make a nice void tile ;)
Definition: void_map.h:21
GWDoneProc
void GWDoneProc()
Procedure called when the genworld process finishes.
Definition: genworld.h:50
Game::GameLoop
static void GameLoop()
Called every game-tick to let Game do something.
Definition: game_core.cpp:32
SetMouseCursorBusy
void SetMouseCursorBusy(bool busy)
Set or unset the ZZZ cursor.
Definition: gfx.cpp:1602
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:553
GWP_OBJECT
Generate objects (radio tower, light houses)
Definition: genworld.h:75
SM_MENU
Switch to game intro menu.
Definition: openttd.h:32
date_func.h
Functions related to dates.
seprintf
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
Definition: string.cpp:398
WC_MODAL_PROGRESS
Progress report of landscape generation; Window numbers:
Definition: window_type.h:458
FindWindowById
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition: window.cpp:1105
Backup::IsValid
bool IsValid() const
Checks whether the variable was already restored.
Definition: backup_type.hpp:65
GenWorldInfo::size_y
uint size_y
Y-size of the map.
Definition: genworld.h:61
GenWorldMode
GenWorldMode
Modes for GenerateWorld.
Definition: genworld.h:28
_GenerateWorld
static void _GenerateWorld(void *)
The internal, real, generate function.
Definition: genworld.cpp:96
GWP_MAP_INIT
Initialize/allocate the map, start economy.
Definition: genworld.h:69
_gw
GenWorldInfo _gw
Please only use this variable in genworld.h and genworld.cpp and nowhere else.
Definition: genworld.cpp:58
EconomySettings::town_layout
TownLayoutByte town_layout
select town layout,
Definition: settings_type.h:485
ShowGenerateWorldProgress
void ShowGenerateWorldProgress()
Show the window where a user can follow the process of the map generation.
Definition: genworld_gui.cpp:1264
GENERATE_NEW_SEED
static const uint GENERATE_NEW_SEED
Create a new random seed.
Definition: genworld.h:25
GenerateTrees
void GenerateTrees()
Place new trees.
Definition: tree_cmd.cpp:300
IsGenerateWorldThreaded
bool IsGenerateWorldThreaded()
Tells if the world generation is done in a thread or not.
Definition: genworld.cpp:67
GenWorldInfo::mode
GenWorldMode mode
What mode are we making a world in.
Definition: genworld.h:58
IsGeneratingWorldAborted
bool IsGeneratingWorldAborted()
Is the generation being aborted?
Definition: genworld.cpp:269
GenWorldInfo::quit_thread
bool quit_thread
Do we want to quit the active thread.
Definition: genworld.h:56
lastof
#define lastof(x)
Get the last element of an fixed size array.
Definition: depend.cpp:50
COMPANY_SPECTATOR
The client is spectating.
Definition: company_type.h:37
genworld.h
Functions related to world/map generation.
GenerateTowns
bool GenerateTowns(TownLayout layout)
This function will generate a certain amount of towns, with a certain layout It can be called from th...
Definition: town_cmd.cpp:1949
AbortGeneratingWorld
void AbortGeneratingWorld()
Initializes the abortion process.
Definition: genworld.cpp:260
ThreadMutex::EndCritical
virtual void EndCritical(bool allow_recursive=false)=0
End of the critical section.
DeleteAllNonVitalWindows
void DeleteAllNonVitalWindows()
It is possible that a stickied window gets to a position where the &#39;close&#39; button is outside the gami...
Definition: window.cpp:3295
GameCreationSettings::se_flat_world_height
byte se_flat_world_height
land height a flat world gets in SE
Definition: settings_type.h:286
SLO_SAVE
File is being saved.
Definition: fileio_type.h:52
GenWorldInfo::size_x
uint size_x
X-size of the map.
Definition: genworld.h:60
_network_dedicated
bool _network_dedicated
are we a dedicated server?
Definition: network.cpp:59
Backup
Class to backup a specific variable and restore it later.
Definition: backup_type.hpp:23
_local_company
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
_modal_progress_work_mutex
ThreadMutex * _modal_progress_work_mutex
Rights for the performing work.
Definition: progress.cpp:21
viewport_func.h
Functions related to (drawing on) viewports.
random_func.hpp
Pseudo random number generator.
GenerateWorldSetAbortCallback
void GenerateWorldSetAbortCallback(GWAbortProc *proc)
Set here the function, if any, that you want to be called when landscape generation is aborted...
Definition: genworld.cpp:233
ConstructionSettings::freeform_edges
bool freeform_edges
allow terraforming the tiles at the map edges
Definition: settings_type.h:312
DFT_GAME_FILE
Save game or scenario file.
Definition: fileio_type.h:33
GenWorldInfo::abort
bool abort
Whether to abort the thread ASAP.
Definition: genworld.h:55
WC_MAIN_WINDOW
Main window; Window numbers:
Definition: window_type.h:46
string_func.h
Functions related to low-level strings.
saveload.h
Functions/types related to saving and loading games.
GenerateWorld
void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings)
Generate a world.
Definition: genworld.cpp:298
error.h
Functions related to errors.
SM_EDITOR
Switch to scenario editor.
Definition: openttd.h:30
HideVitalWindows
void HideVitalWindows()
Delete all always on-top windows to get an empty screen.
Definition: window.cpp:3337
GenWorldInfo::proc
GWDoneProc * proc
Proc that is called when done (can be NULL)
Definition: genworld.h:62
engine_func.h
Functions related to engines.
BasePersistentStorageArray::SwitchMode
static void SwitchMode(PersistentStorageMode mode, bool ignore_prev_mode=false)
Clear temporary changes made since the last call to SwitchMode, and set whether subsequent changes sh...
Definition: newgrf_storage.cpp:57
progress.h
Functions related to modal progress.
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
LoadStringWidthTable
void LoadStringWidthTable(bool monospace)
Initialize _stringwidth_table cache.
Definition: gfx.cpp:1130
PSM_ENTER_GAMELOOP
Enter the gameloop, changes will be permanent.
Definition: newgrf_storage.h:22
safeguards.h
A number of safeguards to prevent using unsafe methods.
SetLocalCompany
void SetLocalCompany(CompanyID new_company)
Sets the local company and updates the settings that are set on a per-company basis to reflect the co...
Definition: company_cmd.cpp:102
_settings_newgame
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
Definition: settings.cpp:78
AUTOSAVE_DIR
Subdirectory of save for autosaves.
Definition: fileio_type.h:113
game_instance.hpp
The GameInstance tracks games.
GenWorldInfo::threaded
bool threaded
Whether we run _GenerateWorld threaded.
Definition: genworld.h:57
OWNER_NONE
The tile has no ownership.
Definition: company_type.h:27
GenWorldInfo
Properties of current genworld process.
Definition: genworld.h:54
GWM_EMPTY
Generate an empty map (sea-level)
Definition: genworld.h:30
network.h
Basic functions/variables used all over the place.
Randomizer::SetSeed
void SetSeed(uint32 seed)
(Re)set the state of the random number generator.
Definition: random_func.cpp:57
Game::GetInstance
static class GameInstance * GetInstance()
Get the current active instance.
Definition: game.hpp:113
SaveOrLoad
SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded)
Main Save or Load function where the high-level saveload functions are handled.
Definition: saveload.cpp:2790
GWP_RUNTILELOOP
Runs the tile loop 1280 times to make snow etc.
Definition: genworld.h:78
_modal_progress_paint_mutex
ThreadMutex * _modal_progress_paint_mutex
Rights for the painting.
Definition: progress.cpp:23
GWAbortProc
void GWAbortProc()
Called when genworld is aborted.
Definition: genworld.h:51
DeleteWindowByClass
void DeleteWindowByClass(WindowClass cls)
Delete all windows of a given class.
Definition: window.cpp:1150
StartupCompanies
void StartupCompanies()
Start the next competitor now.
Definition: company_cmd.cpp:583
Game::StartNew
static void StartNew()
Start up a new GameScript.
Definition: game_core.cpp:65
GenWorldInfo::abortp
GWAbortProc * abortp
Proc that is called when aborting (can be NULL)
Definition: genworld.h:63
CleanupGeneration
static void CleanupGeneration()
Clean up the &#39;mess&#39; of generation.
Definition: genworld.cpp:76
WaitTillGeneratedWorld
void WaitTillGeneratedWorld()
This will wait for the thread to finish up his work.
Definition: genworld.cpp:242
DEBUG
#define DEBUG(name, level,...)
Output a line of debugging information.
Definition: debug.h:39
StartupEngines
void StartupEngines()
Start/initialise all our engines.
Definition: engine.cpp:688
gfxinit.h
Functions related to the graphics initialization.
_tick_counter
uint16 _tick_counter
Ever incrementing (and sometimes wrapping) tick counter for setting off various events.
Definition: date.cpp:30
ShowNewGRFError
void ShowNewGRFError()
Show the first NewGRF error we can find.
Definition: newgrf_gui.cpp:45
UnshowCriticalError
void UnshowCriticalError()
Unshow the critical error.
Definition: error_gui.cpp:357
GenerateWorldSetCallback
void GenerateWorldSetCallback(GWDoneProc *proc)
Set here the function, if any, that you want to be called when landscape generation is done...
Definition: genworld.cpp:223
Backup::Trash
void Trash()
Trash the backup.
Definition: backup_type.hpp:105
ThreadObject::Join
virtual void Join()=0
Join this thread.
company_func.h
Functions related to companies.
HT_NONE
default
Definition: tilehighlight_type.h:22
_generating_world
bool _generating_world
Whether we are generating the map or not.
Definition: genworld.cpp:61
PSM_LEAVE_GAMELOOP
Leave the gameloop, changes will be temporary.
Definition: newgrf_storage.h:23
GameCreationSettings::generation_seed
uint32 generation_seed
noise seed for world generation
Definition: settings_type.h:276
_current_company
CompanyByte _current_company
Company currently doing an action.
Definition: company_cmd.cpp:47
heightmap.h
Functions related to creating heightmaps from files.
_random
Randomizer _random
Random used in the game state calculations.
Definition: random_func.cpp:27
void_map.h
Map accessors for void tiles.
VideoDriver::GetInstance
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
Definition: video_driver.hpp:98
GWP_RUNSCRIPT
Runs the game script at most 2500 times, or when ever the script sleeps.
Definition: genworld.h:79
GenWorldInfo::lc
CompanyID lc
The local_company before generating.
Definition: genworld.h:59
GenWorldInfo::thread
class ThreadObject * thread
The thread we are in (can be NULL)
Definition: genworld.h:64
FlatEmptyWorld
void FlatEmptyWorld(byte tile_height)
Make an empty world where all tiles are of height &#39;tile_height&#39;.
Definition: heightmap.cpp:512
_switch_mode
SwitchMode _switch_mode
The next mainloop command.
Definition: gfx.cpp:47
landscape.h
Functions related to OTTD&#39;s landscape.
ScrollMainWindowToTile
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Definition: viewport.cpp:2268
game.hpp
Base functions for all Games.
SetObjectToPlace
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
Definition: viewport.cpp:3166
GameSettings::construction
ConstructionSettings construction
construction of things in-game
Definition: settings_type.h:545
SetModalProgress
void SetModalProgress(bool state)
Set the modal progress state.
Definition: progress.cpp:30
HandleGeneratingWorldAbortion
void HandleGeneratingWorldAbortion()
Really handle the abortion, i.e.
Definition: genworld.cpp:277
Backup::Restore
void Restore()
Restore the variable.
Definition: backup_type.hpp:114
town.h
Base of the town class.
RunTileLoop
void RunTileLoop()
Gradually iterate over all tiles on the map, calling their TileLoopProcs once every 256 ticks...
Definition: landscape.cpp:721
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition: settings_type.h:544
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows)...
Definition: viewport.cpp:3211
ThreadMutex::BeginCritical
virtual void BeginCritical(bool allow_recursive=false)=0
Begin the critical section.
tilehighlight_func.h
Functions related to tile highlights.
ResetWindowSystem
void ResetWindowSystem()
Reset the windowing system, by means of shutting it down followed by re-initialization.
Definition: window.cpp:1910
window_func.h
Window functions not directly related to making/drawing windows.
ThreadObject::Exit
virtual bool Exit()=0
Exit this thread.
SetGeneratingWorldProgress
void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
Set the total of a stage of the world generation.
Definition: genworld_gui.cpp:1340
water.h
Functions related to water (management)
GenerateLandscape
void GenerateLandscape(byte mode)
Definition: landscape.cpp:1211
IncreaseGeneratingWorldProgress
void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
Increases the current stage of the world generation with one.
Definition: genworld_gui.cpp:1354
GWP_GAME_INIT
Initialize the game.
Definition: genworld.h:77
_date
Date _date
Current date in days (day counter)
Definition: date.cpp:28
ShowVitalWindows
void ShowVitalWindows()
Show the vital in-game windows.
Definition: main_gui.cpp:577
ThreadObject::New
static bool New(OTTDThreadFunc proc, void *param, ThreadObject **thread=NULL, const char *name=NULL)
Create a thread; proc will be called as first function inside the thread, with optional params...
Definition: thread_morphos.cpp:196
backup_type.hpp
Class for backupping variables and making sure they are restored later.
TileXY
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
Definition: map_func.h:165
HasModalProgress
static bool HasModalProgress()
Check if we are currently in a modal progress state.
Definition: progress.h:23
GWP_GAME_START
Really prepare to start the game.
Definition: genworld.h:80
MarkWholeScreenDirty
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1461
GfxLoadSprites
void GfxLoadSprites()
Initialise and load all the sprites.
Definition: gfxinit.cpp:337
ShowFirstError
void ShowFirstError()
Show the first error of the queue.
Definition: error_gui.cpp:343
newgrf.h
Base for the NewGRF implementation.