diff options
author | yexo <yexo@openttd.org> | 2011-05-27 18:02:55 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2011-05-27 18:02:55 +0000 |
commit | ffdfa5a213719a1167ae4a9953a1026ba02848e1 (patch) | |
tree | ba82f4874469431b39c77221d693f52b79aa94a5 /src/ai | |
parent | 56902191e47f863f21f462b9469996371e6ca8f0 (diff) | |
download | openttd-ffdfa5a213719a1167ae4a9953a1026ba02848e1.tar.xz |
(svn r22499) -Fix: don't lower the arrow buttons in the newgrf/AI parameter windows if they're clicked when disabled
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/ai_gui.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 8c552a804..08d332ebf 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -390,6 +390,7 @@ struct AISettingsWindow : public Window { /* One of the arrows is clicked (or green/red rect in case of bool value) */ if (IsInsideMM(x, 0, 21)) { int new_val = this->ai_config->GetSetting(config_item.name); + int old_val = new_val; if (bool_item) { new_val = !new_val; } else if (x >= 10) { @@ -404,19 +405,21 @@ struct AISettingsWindow : public Window { this->clicked_increase = false; } - this->ai_config->SetSetting(config_item.name, new_val); - this->clicked_button = num; - this->timeout = 5; + if (new_val != old_val) { + this->ai_config->SetSetting(config_item.name, new_val); + this->clicked_button = num; + this->timeout = 5; - this->CheckDifficultyLevel(); + this->CheckDifficultyLevel(); + + this->SetDirty(); + } } else if (!bool_item) { /* Display a query box so users can enter a custom value. */ this->clicked_row = num; SetDParam(0, this->ai_config->GetSetting(config_item.name)); ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE); } - - this->SetDirty(); break; } |