summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium42 <rubidium42@users.noreply.github.com>2021-04-11 13:52:55 +0200
committerGitHub <noreply@github.com>2021-04-11 13:52:55 +0200
commitdf045b92ea45ef757dfcfded4b72028ee18ebf0d (patch)
treefd7f230e07c73f770a573aa21b4cf75517972793 /src
parentfdc8230dfa05ffe352f34a302efa40b27f338e5f (diff)
downloadopenttd-df045b92ea45ef757dfcfded4b72028ee18ebf0d.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 235d36f01..250aa0db3 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) {