summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-29 01:03:22 +0000
committeryexo <yexo@openttd.org>2010-01-29 01:03:22 +0000
commita668e801e406718e6e9295db0a0c60be11878afe (patch)
tree659eb43a096b3d79214bea8df282a759b63514e3 /src
parenta43a23b408b5df7ebca5280224a67751f75f9cd6 (diff)
downloadopenttd-a668e801e406718e6e9295db0a0c60be11878afe.tar.xz
(svn r18946) -Fix: it was possible to change AI settings without changing to the custom difficulty level by using the query text window
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai_gui.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 42173bf7c..01506ada5 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -316,6 +316,14 @@ struct AISettingsWindow : public Window {
}
}
+ void CheckDifficultyLevel()
+ {
+ if (_settings_newgame.difficulty.diff_level != 3) {
+ _settings_newgame.difficulty.diff_level = 3;
+ ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, 0, 0);
+ }
+ }
+
virtual void OnClick(Point pt, int widget)
{
switch (widget) {
@@ -353,10 +361,7 @@ struct AISettingsWindow : public Window {
this->clicked_button = num;
this->timeout = 5;
- if (_settings_newgame.difficulty.diff_level != 3) {
- _settings_newgame.difficulty.diff_level = 3;
- ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, 0, 0);
- }
+ this->CheckDifficultyLevel();
} else if (!bool_item) {
/* Display a query box so users can enter a custom value. */
this->clicked_row = num;
@@ -386,6 +391,7 @@ struct AISettingsWindow : public Window {
for (int i = 0; i < this->clicked_row; i++) it++;
int32 value = atoi(str);
this->ai_config->SetSetting((*it).name, value);
+ this->CheckDifficultyLevel();
this->SetDirty();
}