diff options
author | terkhen <terkhen@openttd.org> | 2010-11-04 18:34:37 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-11-04 18:34:37 +0000 |
commit | 725cf7d8bb1604ce4c14d3f44ba3f64872b70768 (patch) | |
tree | 46e566014a436c8e44cbb34ab369be099c20d3da /src/settings.cpp | |
parent | ab9279b5a0e924fc3979c42fd11a04ea48f73124 (diff) | |
download | openttd-725cf7d8bb1604ce4c14d3f44ba3f64872b70768.tar.xz |
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index e91f1cf69..7ef204045 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -902,6 +902,21 @@ static bool InvalidateIndustryViewWindow(int32 p1) return true; } +/** Checks if any settings are set to incorrect values, and sets them to correct values in that case. */ +static void ValidateSettings() +{ + /* Force the difficulty levels to correct values if they are invalid. */ + if (_settings_newgame.difficulty.diff_level != 3) { + SetDifficultyLevel(_settings_newgame.difficulty.diff_level, &_settings_newgame.difficulty); + } + + /* Do not allow a custom sea level with the original land generator. */ + if (_settings_newgame.game_creation.land_generator == 0 && + _settings_newgame.difficulty.quantity_sea_lakes == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) { + _settings_newgame.difficulty.quantity_sea_lakes = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE; + } +} + /* * A: competitors * B: competitor start time. Deprecated since savegame version 110. @@ -941,17 +956,6 @@ void SetDifficultyLevel(int mode, DifficultySettings *gm_opt) } } -/** - * Checks the difficulty levels read from the configuration and - * forces them to be correct when invalid. - */ -static void CheckDifficultyLevels() -{ - if (_settings_newgame.difficulty.diff_level != 3) { - SetDifficultyLevel(_settings_newgame.difficulty.diff_level, &_settings_newgame.difficulty); - } -} - static bool DifficultyReset(int32 level) { SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty); @@ -1477,7 +1481,7 @@ void LoadFromConfig() IniLoadSettings(ini, _gameopt_settings, "gameopt", &_settings_newgame); HandleOldDiffCustom(false); - CheckDifficultyLevels(); + ValidateSettings(); delete ini; } |