From df045b92ea45ef757dfcfded4b72028ee18ebf0d Mon Sep 17 00:00:00 2001 From: rubidium42 Date: Sun, 11 Apr 2021 13:52:55 +0200 Subject: [PATCH] Fix #9008: Validate starting year given on the command line. (#9014) An invalid starting year causes all sorts of weird behaviour and crashes in map generation. Now just set the appropriate setting via IConsoleSetSetting so the validation and, if needed, clamping is performed on the starting year value. --- src/openttd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openttd.cpp b/src/openttd.cpp index 235d36f01b..250aa0db38 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -455,7 +455,7 @@ struct AfterNewGRFScan : NewGRFScanCallback { /* restore saved music volume */ MusicDriver::GetInstance()->SetVolume(_settings_client.music.music_vol); - if (startyear != INVALID_YEAR) _settings_newgame.game_creation.starting_year = startyear; + if (startyear != INVALID_YEAR) IConsoleSetSetting("game_creation.starting_year", startyear); if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed; if (dedicated_host != nullptr) {