summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/fios_gui.cpp4
-rw-r--r--src/openttd.cpp17
-rw-r--r--src/openttd.h5
-rw-r--r--src/video/dedicated_v.cpp6
5 files changed, 20 insertions, 14 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 895e0238d..33ec4784e 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -365,7 +365,7 @@ DEF_CONSOLE_CMD(ConLoad)
if (item != NULL) {
switch (item->type) {
case FIOS_TYPE_FILE: case FIOS_TYPE_OLDFILE: {
- _switch_mode = SM_LOAD;
+ _switch_mode = SM_LOAD_GAME;
SetFiosType(item->type);
strecpy(_file_to_saveload.name, FiosBrowseTo(item), lastof(_file_to_saveload.name));
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 84d41755c..c3b3be621 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -527,7 +527,7 @@ public:
case SLWW_LOAD_BUTTON:
if (this->selected != NULL && !_load_check_data.HasErrors() && (_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs())) {
- _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD;
+ _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
const char *name = FiosBrowseTo(this->selected);
SetFiosType(this->selected->type);
@@ -649,7 +649,7 @@ public:
UpdateTextBufferSize(&this->text);
} else if (this->IsWidgetLowered(SLWW_SAVE_GAME)) { // Save button clicked
- _switch_mode = SM_SAVE;
+ _switch_mode = SM_SAVE_GAME;
FiosMakeSavegameName(_file_to_saveload.name, this->text.buf, sizeof(_file_to_saveload.name));
/* In the editor set up the vehicle engines correctly (date might have changed) */
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 3d6a1ce62..198e648fa 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -456,7 +456,7 @@ int ttd_main(int argc, char *argv[])
case 'g':
if (mgo.opt != NULL) {
strecpy(_file_to_saveload.name, mgo.opt, lastof(_file_to_saveload.name));
- _switch_mode = SM_LOAD;
+ _switch_mode = SM_LOAD_GAME;
_file_to_saveload.mode = SL_LOAD;
/* if the file doesn't exist or it is not a valid savegame, let the saveload code show an error */
@@ -854,10 +854,10 @@ void SwitchToMode(SwitchMode new_mode)
{
#ifdef ENABLE_NETWORK
/* If we are saving something, the network stays in his current state */
- if (new_mode != SM_SAVE) {
+ if (new_mode != SM_SAVE_GAME) {
/* If the network is active, make it not-active */
if (_networking) {
- if (_network_server && (new_mode == SM_LOAD || new_mode == SM_NEWGAME || new_mode == SM_RESTARTGAME)) {
+ if (_network_server && (new_mode == SM_LOAD_GAME || new_mode == SM_NEWGAME || new_mode == SM_RESTARTGAME)) {
NetworkReboot();
} else {
NetworkDisconnect();
@@ -883,7 +883,7 @@ void SwitchToMode(SwitchMode new_mode)
}
#endif /* ENABLE_NETWORK */
/* Make sure all AI controllers are gone at quiting game */
- if (new_mode != SM_SAVE) AI::KillAll();
+ if (new_mode != SM_SAVE_GAME) AI::KillAll();
switch (new_mode) {
case SM_EDITOR: // Switch to scenario editor
@@ -900,7 +900,7 @@ void SwitchToMode(SwitchMode new_mode)
MakeNewGame(false, new_mode == SM_NEWGAME);
break;
- case SM_LOAD: { // Load game, Play Scenario
+ case SM_LOAD_GAME: { // Load game, Play Scenario
ResetGRFConfig(true);
ResetWindowSystem();
@@ -964,7 +964,7 @@ void SwitchToMode(SwitchMode new_mode)
}
break;
- case SM_SAVE: // Save game
+ case SM_SAVE_GAME: // Save game.
/* Make network saved games on pause compatible to singleplayer */
if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) {
SetDParamStr(0, GetSaveLoadErrorString());
@@ -974,6 +974,11 @@ void SwitchToMode(SwitchMode new_mode)
}
break;
+ case SM_SAVE_HEIGHTMAP: // Save heightmap.
+ MakeHeightmapScreenshot(_file_to_saveload.name);
+ DeleteWindowById(WC_SAVELOAD, 0);
+ break;
+
case SM_GENRANDLAND: // Generate random land within scenario editor
SetLocalCompany(OWNER_NONE);
GenerateWorld(GWM_RANDOM, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
diff --git a/src/openttd.h b/src/openttd.h
index e6a04d4bb..b98008493 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -27,9 +27,10 @@ enum SwitchMode {
SM_NEWGAME, ///< New Game --> 'Random game'.
SM_RESTARTGAME, ///< Restart --> 'Random game' with current settings.
SM_EDITOR, ///< Switch to scenario editor.
- SM_LOAD, ///< Load game, Play Scenario.
+ SM_LOAD_GAME, ///< Load game, Play Scenario.
SM_MENU, ///< Switch to game intro menu.
- SM_SAVE, ///< Save game.
+ SM_SAVE_GAME, ///< Save game.
+ SM_SAVE_HEIGHTMAP, ///< Save heightmap.
SM_GENRANDLAND, ///< Generate random land within scenario editor.
SM_LOAD_SCENARIO, ///< Load scenario from scenario editor.
SM_START_HEIGHTMAP, ///< Load a heightmap and start a new game from it.
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 10a1b92b6..d5f63d818 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -270,8 +270,8 @@ void VideoDriver_Dedicated::MainLoop()
_network_dedicated = true;
_current_company = _local_company = COMPANY_SPECTATOR;
- /* If SwitchMode is SM_LOAD, it means that the user used the '-g' options */
- if (_switch_mode != SM_LOAD) {
+ /* If SwitchMode is SM_LOAD_GAME, it means that the user used the '-g' options */
+ if (_switch_mode != SM_LOAD_GAME) {
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
SwitchToMode(_switch_mode);
_switch_mode = SM_NONE;
@@ -285,7 +285,7 @@ void VideoDriver_Dedicated::MainLoop()
_networking = false;
} else {
/* We can load this game, so go ahead */
- SwitchToMode(SM_LOAD);
+ SwitchToMode(SM_LOAD_GAME);
}
}