(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:
rubidium
2007-03-25 19:21:22 +00:00
parent 1a70cf53ff
commit 45e788d524
2 changed files with 22 additions and 2 deletions

View File

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