summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-05-28 13:55:34 +0000
committeralberth <alberth@openttd.org>2011-05-28 13:55:34 +0000
commitf1cae9960f37b853e1abc0c02b6c31590cc86cb1 (patch)
treec7cbb2f604cfafa592aa0c8b263d14d1d7f5da3a /src/openttd.cpp
parent18382251923ac04007a59077f513184a3e66e5ec (diff)
downloadopenttd-f1cae9960f37b853e1abc0c02b6c31590cc86cb1.tar.xz
(svn r22512) -Add: Save heightmap.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp17
1 files changed, 11 insertions, 6 deletions
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);