diff options
author | PeterN <peter@fuzzle.org> | 2019-01-12 23:23:23 +0000 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2019-01-12 23:23:23 +0000 |
commit | 5ff0c24993c52546f1809e87a036d1e8f21d6e17 (patch) | |
tree | 7c1440ca7eb772f21ecd47e7f54f8226d87e03d9 /src/ai | |
parent | 9aecbac2b4a4137abc44ff12a672916ec7482047 (diff) | |
download | openttd-5ff0c24993c52546f1809e87a036d1e8f21d6e17.tar.xz |
Fix #6780: Some windows didn't get updated from OnTick() (#7048)
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/ai_gui.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 101a97d0a..4b248f5ef 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -29,6 +29,7 @@ #include "../widgets/dropdown_func.h" #include "../hotkeys.h" #include "../core/geometry_func.hpp" +#include "../guitimer_func.h" #include "ai.hpp" #include "ai_gui.hpp" @@ -286,7 +287,7 @@ struct AISettingsWindow : public Window { bool clicked_increase; ///< Whether we clicked the increase or decrease button. bool clicked_dropdown; ///< Whether the dropdown is open. bool closing_dropdown; ///< True, if the dropdown list is currently closing. - int timeout; ///< Timeout for unclicking the button. + GUITimer timeout; ///< Timeout for unclicking the button. int clicked_row; ///< The clicked row of settings. int line_height; ///< Height of a row in the matrix widget. Scrollbar *vscroll; ///< Cache of the vertical scrollbar. @@ -505,7 +506,7 @@ struct AISettingsWindow : public Window { if (new_val != old_val) { this->ai_config->SetSetting(config_item.name, new_val); this->clicked_button = num; - this->timeout = 5; + this->timeout.SetInterval(150); } } else if (!bool_item && !config_item.complete_labels) { /* Display a query box so users can enter a custom value. */ @@ -568,9 +569,9 @@ struct AISettingsWindow : public Window { this->vscroll->SetCapacityFromWidget(this, WID_AIS_BACKGROUND); } - virtual void OnTick() + virtual void OnRealtimeTick(uint delta_ms) { - if (--this->timeout == 0) { + if (this->timeout.Elapsed(delta_ms)) { this->clicked_button = -1; this->SetDirty(); } |