From 5ff0c24993c52546f1809e87a036d1e8f21d6e17 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sat, 12 Jan 2019 23:23:23 +0000 Subject: Fix #6780: Some windows didn't get updated from OnTick() (#7048) --- src/ai/ai_gui.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ai/ai_gui.cpp') 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(); } -- cgit v1.2.3-54-g00ecf