summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorBerbe <4251220+Berbe@users.noreply.github.com>2019-08-08 16:27:02 +0200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2020-01-12 23:47:19 +0100
commit2fc2058b3b2dacb458e53eadd9e956326b3d30d9 (patch)
tree97cbaf4364d02112d2eef6df4dabf3097d45a956 /src/network
parentdbbd0f5ddc39b1624749575195f47a144361b1a5 (diff)
downloadopenttd-2fc2058b3b2dacb458e53eadd9e956326b3d30d9.tar.xz
Feature: Auto-restart loads the original resources again
If the game was started loading a savegame or scenario, auto-restart will load a new random map. This is inconsistent with the case in which a heightmap was loaded, as in that case the heightmap is kept as a basis for a new game. This proposal solves this heterogeneity be considering the originally loaded resource shall be kept, hence savegames & scenarios shall be reloaded
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_server.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index f9c9e91f2..f68cfd05c 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1589,7 +1589,20 @@ static void NetworkCheckRestartMap()
if (_settings_client.network.restart_game_year != 0 && _cur_year >= _settings_client.network.restart_game_year) {
DEBUG(net, 0, "Auto-restarting map. Year %d reached", _cur_year);
- StartNewGameWithoutGUI(GENERATE_NEW_SEED);
+ _settings_newgame.game_creation.generation_seed = GENERATE_NEW_SEED;
+ switch(_file_to_saveload.abstract_ftype) {
+ case FT_SAVEGAME:
+ case FT_SCENARIO:
+ _switch_mode = SM_LOAD_GAME;
+ break;
+
+ case FT_HEIGHTMAP:
+ _switch_mode = SM_START_HEIGHTMAP;
+ break;
+
+ default:
+ _switch_mode = SM_NEWGAME;
+ }
}
}