summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-01-01 23:26:26 +0000
committeryexo <yexo@openttd.org>2011-01-01 23:26:26 +0000
commita25d6c64dde115f6ee5c0cec54750257cc932388 (patch)
tree6f2ab6fc368ae114aaa200202549eacb0706b7a8 /src
parentc6a90361fce4e29c9b8093b2c876ca08f521f192 (diff)
downloadopenttd-a25d6c64dde115f6ee5c0cec54750257cc932388.tar.xz
(svn r21694) -Fix: changing AI settings ingame was impossible when the difficulty level was other than custom
Diffstat (limited to 'src')
-rw-r--r--src/settings.cpp3
-rw-r--r--src/table/settings.h2
2 files changed, 4 insertions, 1 deletions
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),