summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-08 16:21:54 +0100
committerPatric Stout <github@truebrain.nl>2021-01-11 20:11:08 +0100
commitff89f5f4c6deff65fab5f08f32e6d2bb07c7a632 (patch)
tree73ea1fa00ceef3e49796f82999535a7b0d7b384b
parentfe86bf8bf66775201924d01b14e3de821ab81902 (diff)
downloadopenttd-ff89f5f4c6deff65fab5f08f32e6d2bb07c7a632.tar.xz
Fix 8f3d1ec: "restart" did not always restart your current game
In the sequence: - Load a game - Start a newgame (via console) - Restart a game (via console) Gave you the loaded game back, not the new game.
-rw-r--r--src/openttd.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 41900933a..805e591b9 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -928,6 +928,10 @@ static void MakeNewGameDone()
static void MakeNewGame(bool from_heightmap, bool reset_settings)
{
_game_mode = GM_NORMAL;
+ if (!from_heightmap) {
+ /* "reload" command needs to know what mode we were in. */
+ _file_to_saveload.SetMode(SLO_INVALID, FT_INVALID, DFT_INVALID);
+ }
ResetGRFConfig(true);
@@ -943,6 +947,8 @@ static void MakeNewEditorWorldDone()
static void MakeNewEditorWorld()
{
_game_mode = GM_EDITOR;
+ /* "reload" command needs to know what mode we were in. */
+ _file_to_saveload.SetMode(SLO_INVALID, FT_INVALID, DFT_INVALID);
ResetGRFConfig(true);
@@ -1052,9 +1058,9 @@ void SwitchToMode(SwitchMode new_mode)
SwitchToMode(_switch_mode);
break;
}
- /* No break here, to enter the next case:
- * Restart --> 'Random game' with current settings */
- FALLTHROUGH;
+
+ MakeNewGame(false, new_mode == SM_NEWGAME);
+ break;
case SM_NEWGAME: // New Game --> 'Random game'
if (_network_server) {