forked from mirror/OpenTTD
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
This commit is contained in:
@@ -369,6 +369,23 @@ void SetDifficultyLevel(int mode, GameOptions *gm_opt)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the difficulty levels read from the configuration and
|
||||
* forces them to be correct when invalid.
|
||||
*/
|
||||
void CheckDifficultyLevels()
|
||||
{
|
||||
if (_opt_newgame.diff_level != 3) {
|
||||
SetDifficultyLevel(_opt_newgame.diff_level, &_opt_newgame);
|
||||
} else {
|
||||
for (uint i = 0; i < GAME_DIFFICULTY_NUM; i++) {
|
||||
int *diff = ((int*)&_opt_newgame.diff) + i;
|
||||
*diff = clamp(*diff, _game_setting_info[i].min, _game_setting_info[i].max);
|
||||
*diff -= *diff % _game_setting_info[i].step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void StartupEconomy();
|
||||
|
||||
enum {
|
||||
|
Reference in New Issue
Block a user