OpenTTD Source: src/genworld.cpp Source File

OpenTTD Source 14.1

genworld.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
7
10 #include "stdafx.h"
11 #include "landscape.h"
12 #include "company_func.h"
13 #include "genworld.h"
14 #include "gfxinit.h"
15 #include "window_func.h"
16 #include "network/network.h"
17 #include "heightmap.h"
18 #include "viewport_func.h"
19 #include "timer/timer_game_calendar.h"
20 #include "timer/timer_game_tick.h"
21 #include "engine_func.h"
22 #include "water.h"
23 #include "video/video_driver.hpp"
24 #include "tilehighlight_func.h"
25 #include "saveload/saveload.h"
26 #include "void_map.h"
27 #include "town.h"
28 #include "newgrf.h"
29 #include "core/random_func.hpp"
30 #include "core/backup_type.hpp"
31 #include "progress.h"
32 #include "error.h"
33 #include "game/game.hpp"
34 #include "game/game_instance.hpp"
35 #include "string_func.h"
36 #include "thread.h"
37 #include "tgp.h"
38
39 #include "safeguards.h"
40
41
42 void GenerateClearTile();
43 void GenerateIndustries();
44 void GenerateObjects();
45 void GenerateTrees();
46
47 void StartupEconomy();
48 void StartupCompanies();
49 void StartupDisasters();
50
51 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings);
52
59 GenWorldInfo _gw;
60
62 bool _generating_world;
63
64 class AbortGenerateWorldSignal { };
65
69 static void CleanupGeneration()
70 {
71 _generating_world = false;
72
73 SetMouseCursorBusy(false);
74 SetModalProgress(false);
75 _gw.proc = nullptr;
76 _gw.abortp = nullptr;
77
78 CloseWindowByClass(WC_MODAL_PROGRESS);
79 ShowFirstError();
80 MarkWholeScreenDirty();
81 }
82
86 static void _GenerateWorld()
87 {
88 /* Make sure everything is done via OWNER_NONE. */
89 Backup<CompanyID> _cur_company(_current_company, OWNER_NONE, FILE_LINE);
90
91 try {
92 _generating_world = true;
93 if (_network_dedicated) Debug(net, 3, "Generating map, please wait...");
94 /* Set the Random() seed to generation_seed so we produce the same map with the same seed */
95 _random.SetSeed(_settings_game.game_creation.generation_seed);
96 SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
97 SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
98 ScriptObject::InitializeRandomizers();
99
100 BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
101
102 IncreaseGeneratingWorldProgress(GWP_MAP_INIT);
103 /* Must start economy early because of the costs. */
104 StartupEconomy();
105 if (!CheckTownRoadTypes()) {
106 HandleGeneratingWorldAbortion();
107 return;
108 }
109
110 bool landscape_generated = false;
111
112 /* Don't generate landscape items when in the scenario editor. */
113 if (_gw.mode != GWM_EMPTY) {
114 landscape_generated = GenerateLandscape(_gw.mode);
115 }
116
117 if (!landscape_generated) {
118 SetGeneratingWorldProgress(GWP_OBJECT, 1);
119
120 /* Make sure the tiles at the north border are void tiles if needed. */
121 if (_settings_game.construction.freeform_edges) {
122 for (uint x = 0; x < Map::SizeX(); x++) MakeVoid(TileXY(x, 0));
123 for (uint y = 0; y < Map::SizeY(); y++) MakeVoid(TileXY(0, y));
124 }
125
126 /* Make the map the height of the setting */
127 if (_game_mode != GM_MENU) FlatEmptyWorld(_settings_game.game_creation.se_flat_world_height);
128
129 ConvertGroundTilesIntoWaterTiles();
130 IncreaseGeneratingWorldProgress(GWP_OBJECT);
131
132 _settings_game.game_creation.snow_line_height = DEF_SNOWLINE_HEIGHT;
133 } else {
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 HandleGeneratingWorldAbortion();
140 return;
141 }
142 GenerateIndustries();
143 GenerateObjects();
144 GenerateTrees();
145 }
146 }
147
148 /* These are probably pointless when inside the scenario editor. */
149 SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
150 StartupCompanies();
151 IncreaseGeneratingWorldProgress(GWP_GAME_INIT);
152 StartupEngines();
153 IncreaseGeneratingWorldProgress(GWP_GAME_INIT);
154 StartupDisasters();
155 _generating_world = false;
156
157 /* No need to run the tile loop in the scenario editor. */
158 if (_gw.mode != GWM_EMPTY) {
159 uint i;
160
161 SetGeneratingWorldProgress(GWP_RUNTILELOOP, 0x500);
162 for (i = 0; i < 0x500; i++) {
163 RunTileLoop();
164 TimerGameTick::counter++;
165 IncreaseGeneratingWorldProgress(GWP_RUNTILELOOP);
166 }
167
168 if (_game_mode != GM_EDITOR) {
169 Game::StartNew();
170
171 if (Game::GetInstance() != nullptr) {
172 SetGeneratingWorldProgress(GWP_RUNSCRIPT, 2500);
173 _generating_world = true;
174 for (i = 0; i < 2500; i++) {
175 Game::GameLoop();
176 IncreaseGeneratingWorldProgress(GWP_RUNSCRIPT);
177 if (Game::GetInstance()->IsSleeping()) break;
178 }
179 _generating_world = false;
180 }
181 }
182 }
183
184 BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);
185
186 ResetObjectToPlace();
187 _cur_company.Trash();
188 _current_company = _local_company = _gw.lc;
189 /* Show all vital windows again, because we have hidden them. */
190 if (_game_mode != GM_MENU) ShowVitalWindows();
191
192 SetGeneratingWorldProgress(GWP_GAME_START, 1);
193 /* Call any callback */
194 if (_gw.proc != nullptr) _gw.proc();
195 IncreaseGeneratingWorldProgress(GWP_GAME_START);
196
197 CleanupGeneration();
198
199 ShowNewGRFError();
200
201 if (_network_dedicated) Debug(net, 3, "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 std::string name = fmt::format("dmp_cmds_{:08x}_{:08x}.sav", _settings_game.game_creation.generation_seed, TimerGameEconomy::date);
206 SaveOrLoad(name, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
207 }
208 } catch (AbortGenerateWorldSignal&) {
209 CleanupGeneration();
210
211 BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP, true);
212 if (_cur_company.IsValid()) _cur_company.Restore();
213
214 if (_network_dedicated) {
215 /* Exit the game to prevent a return to main menu. */
216 Debug(net, 0, "Generating map failed; closing server");
217 _exit_game = true;
218 } else {
219 SwitchToMode(_switch_mode);
220 }
221 }
222 }
223
229 void GenerateWorldSetCallback(GWDoneProc *proc)
230 {
231 _gw.proc = proc;
232 }
233
239 void GenerateWorldSetAbortCallback(GWAbortProc *proc)
240 {
241 _gw.abortp = proc;
242 }
243
247 void AbortGeneratingWorld()
248 {
249 _gw.abort = true;
250 }
251
256 bool IsGeneratingWorldAborted()
257 {
258 return _gw.abort || _exit_game;
259 }
260
264 void HandleGeneratingWorldAbortion()
265 {
266 /* Clean up - in SE create an empty map, otherwise, go to intro menu */
267 _switch_mode = (_game_mode == GM_EDITOR) ? SM_EDITOR : SM_MENU;
268
269 if (_gw.abortp != nullptr) _gw.abortp();
270
271 throw AbortGenerateWorldSignal();
272 }
273
281 void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings)
282 {
283 if (HasModalProgress()) return;
284 _gw.mode = mode;
285 _gw.size_x = size_x;
286 _gw.size_y = size_y;
287 SetModalProgress(true);
288 _gw.abort = false;
289 _gw.abortp = nullptr;
290 _gw.lc = _local_company;
291
292 /* This disables some commands and stuff */
293 SetLocalCompany(COMPANY_SPECTATOR);
294
295 InitializeGame(_gw.size_x, _gw.size_y, true, reset_settings);
296 PrepareGenerateWorldProgress();
297
298 if (_settings_game.construction.map_height_limit == 0) {
299 uint estimated_height = 0;
300
301 if (_gw.mode == GWM_EMPTY && _game_mode != GM_MENU) {
302 estimated_height = _settings_game.game_creation.se_flat_world_height;
303 } else if (_gw.mode == GWM_HEIGHTMAP) {
304 estimated_height = _settings_game.game_creation.heightmap_height;
305 } else if (_settings_game.game_creation.land_generator == LG_TERRAGENESIS) {
306 estimated_height = GetEstimationTGPMapHeight();
307 } else {
308 estimated_height = 0;
309 }
310
311 _settings_game.construction.map_height_limit = std::max(MAP_HEIGHT_LIMIT_AUTO_MINIMUM, std::min(MAX_MAP_HEIGHT_LIMIT, estimated_height + MAP_HEIGHT_LIMIT_AUTO_CEILING_ROOM));
312 }
313
314 if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = InteractiveRandom();
315
316 /* Load the right landscape stuff, and the NewGRFs! */
317 GfxLoadSprites();
318 LoadStringWidthTable();
319
320 /* Re-init the windowing system */
321 ResetWindowSystem();
322
323 /* Create toolbars */
324 SetupColoursAndInitialWindow();
325 SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
326
327 UnshowCriticalError();
328 CloseAllNonVitalWindows();
329 HideVitalWindows();
330
331 ShowGenerateWorldProgress();
332
333 /* Centre the view on the map */
334 ScrollMainWindowToTile(TileXY(Map::SizeX() / 2, Map::SizeY() / 2), true);
335
336 _GenerateWorld();
337 }
GenWorldInfo::size_y
uint size_y
Y-size of the map.
Definition: genworld.h:63
game.hpp
LoadStringWidthTable
void LoadStringWidthTable(bool monospace)
Initialize _stringwidth_table cache.
Definition: gfx.cpp:1229
ShowFirstError
void ShowFirstError()
Show the first error of the queue.
Definition: error_gui.cpp:335
GWP_GAME_INIT
@ GWP_GAME_INIT
Initialize the game.
Definition: genworld.h:78
SetMouseCursorBusy
void SetMouseCursorBusy(bool busy)
Set or unset the ZZZ cursor.
Definition: gfx.cpp:1689
ShowGenerateWorldProgress
void ShowGenerateWorldProgress()
Show the window where a user can follow the process of the map generation.
Definition: genworld_gui.cpp:1468
CloseWindowByClass
void CloseWindowByClass(WindowClass cls, int data)
Close all windows of a given class.
Definition: window.cpp:1153
HideVitalWindows
void HideVitalWindows()
Close all always on-top windows to get an empty screen.
Definition: window.cpp:3303
game_instance.hpp
GWP_RUNTILELOOP
@ GWP_RUNTILELOOP
Runs the tile loop 1280 times to make snow etc.
Definition: genworld.h:79
ScrollMainWindowToTile
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Definition: viewport.cpp:2509
_GenerateWorld
static void _GenerateWorld()
The internal, real, generate function.
Definition: genworld.cpp:86
TimerGameTick::counter
static TickCounter counter
Monotonic counter, in ticks, since start of game.
Definition: timer_game_tick.h:60
GenWorldInfo::abort
bool abort
Whether to abort the thread ASAP.
Definition: genworld.h:59
water.h
GenWorldInfo::lc
CompanyID lc
The local_company before generating.
Definition: genworld.h:61
tgp.h
_gw
GenWorldInfo _gw
Please only use this variable in genworld.h and genworld.cpp and nowhere else.
Definition: genworld.cpp:59
AbortGeneratingWorld
void AbortGeneratingWorld()
Initializes the abortion process.
Definition: genworld.cpp:247
EconomySettings::town_layout
TownLayout town_layout
select town layout,
Definition: settings_type.h:552
Backup
Class to backup a specific variable and restore it later.
Definition: backup_type.hpp:21
GenWorldInfo::abortp
GWAbortProc * abortp
Proc that is called when aborting (can be nullptr)
Definition: genworld.h:65
timer_game_calendar.h
SaveOrLoad
SaveOrLoadResult SaveOrLoad(const std::string &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:3052
SM_EDITOR
@ SM_EDITOR
Switch to scenario editor.
Definition: openttd.h:31
AbortGenerateWorldSignal
Definition: genworld.cpp:64
GenWorldInfo::mode
GenWorldMode mode
What mode are we making a world in.
Definition: genworld.h:60
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:229
CheckTownRoadTypes
bool CheckTownRoadTypes()
Check if towns are able to build road.
Definition: town_cmd.cpp:968
void_map.h
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:115
DFT_GAME_FILE
@ DFT_GAME_FILE
Save game or scenario file.
Definition: fileio_type.h:31
saveload.h
_random
Randomizer _random
Random used in the game state calculations.
Definition: random_func.cpp:37
AUTOSAVE_DIR
@ AUTOSAVE_DIR
Subdirectory of save for autosaves.
Definition: fileio_type.h:111
GWAbortProc
void GWAbortProc()
Called when genworld is aborted.
Definition: genworld.h:55
GetEstimationTGPMapHeight
uint GetEstimationTGPMapHeight()
Get an overestimation of the highest peak TGP wants to generate.
Definition: tgp.cpp:252
town.h
DEF_SNOWLINE_HEIGHT
static const uint DEF_SNOWLINE_HEIGHT
Default snowline height.
Definition: tile_type.h:33
StartupEngines
void StartupEngines()
Start/initialise all our engines.
Definition: engine.cpp:763
genworld.h
GameCreationSettings::heightmap_height
byte heightmap_height
highest mountain for heightmap (towards what it scales)
Definition: settings_type.h:349
IncreaseGeneratingWorldProgress
void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
Increases the current stage of the world generation with one.
Definition: genworld_gui.cpp:1550
ShowNewGRFError
void ShowNewGRFError()
Show the first NewGRF error we can find.
Definition: newgrf_gui.cpp:45
Debug
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Definition: debug.h:37
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition: settings_type.h:618
GenerateLandscape
bool GenerateLandscape(byte mode)
Definition: landscape.cpp:1562
GenWorldInfo::proc
GWDoneProc * proc
Proc that is called when done (can be nullptr)
Definition: genworld.h:64
WC_MODAL_PROGRESS
@ WC_MODAL_PROGRESS
Progress report of landscape generation; Window numbers:
Definition: window_type.h:463
heightmap.h
ShowVitalWindows
void ShowVitalWindows()
Show the vital in-game windows.
Definition: main_gui.cpp:569
GWM_HEIGHTMAP
@ GWM_HEIGHTMAP
Generate a newgame from a heightmap.
Definition: genworld.h:31
SLO_SAVE
@ SLO_SAVE
File is being saved.
Definition: fileio_type.h:50
tilehighlight_func.h
Randomizer::SetSeed
void SetSeed(uint32_t seed)
(Re)set the state of the random number generator.
Definition: random_func.cpp:67
MAX_MAP_HEIGHT_LIMIT
static const uint MAX_MAP_HEIGHT_LIMIT
Upper bound of maximum allowed heightlevel (in the construction settings)
Definition: tile_type.h:30
ConstructionSettings::map_height_limit
uint8_t map_height_limit
the maximum allowed heightlevel
Definition: settings_type.h:369
MakeVoid
void MakeVoid(Tile t)
Make a nice void tile ;)
Definition: void_map.h:19
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:239
GenerateTrees
void GenerateTrees()
Place new trees.
Definition: tree_cmd.cpp:353
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:55
HasModalProgress
bool HasModalProgress()
Check if we are currently in a modal progress state.
Definition: progress.h:17
PSM_ENTER_GAMELOOP
@ PSM_ENTER_GAMELOOP
Enter the gameloop, changes will be permanent.
Definition: newgrf_storage.h:21
timer_game_tick.h
MAP_HEIGHT_LIMIT_AUTO_MINIMUM
static const uint MAP_HEIGHT_LIMIT_AUTO_MINIMUM
When map height limit is auto, make this the lowest possible map height limit.
Definition: genworld.h:51
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:627
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:50
GameCreationSettings::snow_line_height
byte snow_line_height
the configured snow line height (deduced from "snow_coverage")
Definition: settings_type.h:346
safeguards.h
GWP_GAME_START
@ GWP_GAME_START
Really prepare to start the game.
Definition: genworld.h:81
GWP_OBJECT
@ GWP_OBJECT
Generate objects (radio tower, light houses)
Definition: genworld.h:76
ConstructionSettings::freeform_edges
bool freeform_edges
allow terraforming the tiles at the map edges
Definition: settings_type.h:382
GWP_MAP_INIT
@ GWP_MAP_INIT
Initialize/allocate the map, start economy.
Definition: genworld.h:70
GameCreationSettings::se_flat_world_height
byte se_flat_world_height
land height a flat world gets in SE
Definition: settings_type.h:353
HT_NONE
@ HT_NONE
default
Definition: tilehighlight_type.h:20
gfxinit.h
error.h
_network_dedicated
bool _network_dedicated
are we a dedicated server?
Definition: network.cpp:68
MAP_HEIGHT_LIMIT_AUTO_CEILING_ROOM
static const uint MAP_HEIGHT_LIMIT_AUTO_CEILING_ROOM
When map height limit is auto, the map height limit will be the higest peak plus this value.
Definition: genworld.h:52
stdafx.h
landscape.h
viewport_func.h
FlatEmptyWorld
void FlatEmptyWorld(byte tile_height)
Make an empty world where all tiles are of height 'tile_height'.
Definition: heightmap.cpp:546
Backup::IsValid
bool IsValid() const
Checks whether the variable was already restored.
Definition: backup_type.hpp:63
GENERATE_NEW_SEED
static const uint32_t GENERATE_NEW_SEED
Create a new random seed.
Definition: genworld.h:24
GenWorldInfo
Properties of current genworld process.
Definition: genworld.h:58
Map::SizeX
static debug_inline uint SizeX()
Get the size of the map along the X.
Definition: map_func.h:270
_generating_world
bool _generating_world
Whether we are generating the map or not.
Definition: genworld.cpp:62
string_func.h
_switch_mode
SwitchMode _switch_mode
The next mainloop command.
Definition: gfx.cpp:48
_current_company
CompanyID _current_company
Company currently doing an action.
Definition: company_cmd.cpp:51
Game::GameLoop
static void GameLoop()
Called every game-tick to let Game do something.
Definition: game_core.cpp:31
Backup::Trash
void Trash()
Trash the backup.
Definition: backup_type.hpp:103
GenerateTowns
bool GenerateTowns(TownLayout layout)
Generate a number of towns with a given layout.
Definition: town_cmd.cpp:2368
PrepareGenerateWorldProgress
void PrepareGenerateWorldProgress()
Initializes the progress counters to the starting point.
Definition: genworld_gui.cpp:1456
GameCreationSettings::generation_seed
uint32_t generation_seed
noise seed for world generation
Definition: settings_type.h:339
HandleGeneratingWorldAbortion
void HandleGeneratingWorldAbortion()
Really handle the abortion, i.e.
Definition: genworld.cpp:264
Backup::Restore
void Restore()
Restore the variable.
Definition: backup_type.hpp:112
UnshowCriticalError
void UnshowCriticalError()
Unshow the critical error.
Definition: error_gui.cpp:349
GameCreationSettings::land_generator
byte land_generator
the landscape generator
Definition: settings_type.h:344
video_driver.hpp
COMPANY_SPECTATOR
@ COMPANY_SPECTATOR
The client is spectating.
Definition: company_type.h:35
SetGeneratingWorldProgress
void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
Set the total of a stage of the world generation.
Definition: genworld_gui.cpp:1536
OWNER_NONE
@ OWNER_NONE
The tile has no ownership.
Definition: company_type.h:25
GWM_EMPTY
@ GWM_EMPTY
Generate an empty map (sea-level)
Definition: genworld.h:29
newgrf.h
LG_TERRAGENESIS
@ LG_TERRAGENESIS
TerraGenesis Perlin landscape generator.
Definition: genworld.h:21
progress.h
WC_MAIN_WINDOW
@ WC_MAIN_WINDOW
Main window; Window numbers:
Definition: window_type.h:51
GfxLoadSprites
void GfxLoadSprites()
Initialise and load all the sprites.
Definition: gfxinit.cpp:327
company_func.h
SM_MENU
@ SM_MENU
Switch to game intro menu.
Definition: openttd.h:33
GenerateIndustries
void GenerateIndustries()
This function will create random industries during game creation.
Definition: industry_cmd.cpp:2444
network.h
window_func.h
MarkWholeScreenDirty
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1548
TileXY
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
Definition: map_func.h:385
StartupCompanies
void StartupCompanies()
Start of a new game.
Definition: company_cmd.cpp:656
random_func.hpp
GenWorldInfo::size_x
uint size_x
X-size of the map.
Definition: genworld.h:62
IsGeneratingWorldAborted
bool IsGeneratingWorldAborted()
Is the generation being aborted?
Definition: genworld.cpp:256
GenerateWorld
void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings)
Generate a world.
Definition: genworld.cpp:281
PSM_LEAVE_GAMELOOP
@ PSM_LEAVE_GAMELOOP
Leave the gameloop, changes will be temporary.
Definition: newgrf_storage.h:22
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:54
CleanupGeneration
static void CleanupGeneration()
Generation is done; show windows again and delete the progress window.
Definition: genworld.cpp:69
ResetWindowSystem
void ResetWindowSystem()
Reset the windowing system, by means of shutting it down followed by re-initialization.
Definition: window.cpp:1819
GameSettings::construction
ConstructionSettings construction
construction of things in-game
Definition: settings_type.h:619
CloseAllNonVitalWindows
void CloseAllNonVitalWindows()
It is possible that a stickied window gets to a position where the 'close' button is outside the gami...
Definition: window.cpp:3265
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:3435
GenWorldMode
GenWorldMode
Modes for GenerateWorld.
Definition: genworld.h:27
GWDoneProc
void GWDoneProc()
Procedure called when the genworld process finishes.
Definition: genworld.h:54
SetModalProgress
void SetModalProgress(bool state)
Set the modal progress state.
Definition: progress.cpp:22
Game::GetInstance
static class GameInstance * GetInstance()
Get the current active instance.
Definition: game.hpp:101
thread.h
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3483
Game::StartNew
static void StartNew()
Start up a new GameScript.
Definition: game_core.cpp:72
Map::SizeY
static uint SizeY()
Get the size of the map along the Y.
Definition: map_func.h:279
SetupColoursAndInitialWindow
void SetupColoursAndInitialWindow()
Initialise the default colours (remaps and the likes), and load the main windows.
Definition: main_gui.cpp:541
engine_func.h
GWP_RUNSCRIPT
@ GWP_RUNSCRIPT
Runs the game script at most 2500 times, or when ever the script sleeps.
Definition: genworld.h:80
RunTileLoop
void RunTileLoop()
Gradually iterate over all tiles on the map, calling their TileLoopProcs once every 256 ticks.
Definition: landscape.cpp:761
backup_type.hpp
TimerGameEconomy::date
static Date date
Current date in days (day counter).
Definition: timer_game_economy.h:37