From a25d6c64dde115f6ee5c0cec54750257cc932388 Mon Sep 17 00:00:00 2001 From: yexo Date: Sat, 1 Jan 2011 23:26:26 +0000 Subject: (svn r21694) -Fix: changing AI settings ingame was impossible when the difficulty level was other than custom --- src/settings.cpp | 3 +++ src/table/settings.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/settings.cpp b/src/settings.cpp index 964631f5d..82b3a3538 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -977,6 +977,9 @@ static void ValidateSettings() static bool DifficultyReset(int32 level) { + /* In game / in the scenario editor you can set the difficulty level only to custom. This is + * needed by the AI Gui code that sets the difficulty level when you change any AI settings. */ + if (_game_mode != GM_MENU && level != 3) return false; SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty); return true; } diff --git a/src/table/settings.h b/src/table/settings.h index b12efcc4c..dea9c94d9 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -362,7 +362,7 @@ const SettingDesc _settings[] = { SDT_CONDVAR(GameSettings, difficulty.line_reverse_mode, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 1, 1, STR_REVERSE_AT_END_OF_LINE_AND_AT_STATIONS,DifficultyChange), SDT_CONDVAR(GameSettings, difficulty.disasters, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 1, 1, STR_DISASTERS_OFF, DifficultyChange), SDT_CONDVAR(GameSettings, difficulty.town_council_tolerance, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 2, 1, STR_CITY_APPROVAL_PERMISSIVE, DifficultyNoiseChange), - SDT_CONDVAR(GameSettings, difficulty.diff_level, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 3, 0, 3, 0, STR_NULL, DifficultyReset), + SDT_CONDVAR(GameSettings, difficulty.diff_level, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 3, 0, 3, 0, STR_NULL, DifficultyReset), /* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */ SDT_CONDOMANY(GameSettings, game_creation.town_name, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 255, _town_names, STR_NULL, NULL, NULL), -- cgit v1.2.3-54-g00ecf