mirror of
https://github.com/OpenTTD/OpenTTD
synced 2025-12-24 05:32:59 +01:00
(svn r9582) [0.5] -Backport from trunk (r9425, r9437, r9455, r9519):
- Fix: housekeeping in convert rail functions (r9425) - Fix: dedicated server crashed when the y part of the resolution was less than 10 (r9437) - Fix: values of diff_custom and snow_line in .cfg weren't checked properly (r9455) - Fix: free the malloc'd variable, not the pointer to that variable (r9519)
This commit is contained in:
@@ -368,6 +368,24 @@ 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(void)
|
||||
{
|
||||
if (_opt_newgame.diff_level != 3) {
|
||||
SetDifficultyLevel(_opt_newgame.diff_level, &_opt_newgame);
|
||||
} else {
|
||||
uint i;
|
||||
for (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(void);
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user