Changeset - r25159:dc04dd59c15a
[Not reviewed]
master
0 1 0
rubidium42 - 3 years ago 2021-04-11 11:52:55
rubidium42@users.noreply.github.com
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.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/openttd.cpp
Show inline comments
 
@@ -452,13 +452,13 @@ struct AfterNewGRFScan : NewGRFScanCallb
 
		/* We have loaded the config, so we may possibly save it. */
 
		_save_config = save_config;
 

	
 
		/* 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) {
 
			_network_bind_list.clear();
 
			_network_bind_list.emplace_back(dedicated_host);
 
		}
0 comments (0 inline, 0 general)