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.
This commit is contained in:
rubidium42 2021-04-11 13:52:55 +02:00 committed by Charles Pigott
parent 3d0c109d82
commit cbc1d0c893
1 changed files with 1 additions and 1 deletions

View File

@ -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) {