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.
pull/217/head
Patric Stout 4 years ago committed by Patric Stout
parent fe86bf8bf6
commit ff89f5f4c6

@ -928,6 +928,10 @@ static void MakeNewGameDone()
static void MakeNewGame(bool from_heightmap, bool reset_settings) static void MakeNewGame(bool from_heightmap, bool reset_settings)
{ {
_game_mode = GM_NORMAL; _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); ResetGRFConfig(true);
@ -943,6 +947,8 @@ static void MakeNewEditorWorldDone()
static void MakeNewEditorWorld() static void MakeNewEditorWorld()
{ {
_game_mode = GM_EDITOR; _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); ResetGRFConfig(true);
@ -1052,9 +1058,9 @@ void SwitchToMode(SwitchMode new_mode)
SwitchToMode(_switch_mode); SwitchToMode(_switch_mode);
break; break;
} }
/* No break here, to enter the next case:
* Restart --> 'Random game' with current settings */ MakeNewGame(false, new_mode == SM_NEWGAME);
FALLTHROUGH; break;
case SM_NEWGAME: // New Game --> 'Random game' case SM_NEWGAME: // New Game --> 'Random game'
if (_network_server) { if (_network_server) {

Loading…
Cancel
Save