summaryrefslogtreecommitdiff
path: root/src/toolbar_gui.cpp
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2018-05-20 09:58:36 +0100
committerPeterN <peter@fuzzle.org>2019-01-11 11:56:21 +0000
commit806e7d25dddcc8b0e9c3f372ed956c63c6508381 (patch)
treed79d90933423d8cafef1420cd200bc506a138713 /src/toolbar_gui.cpp
parent59fe4f28c8f0bf47e7af40095dc6fba145188930 (diff)
downloadopenttd-806e7d25dddcc8b0e9c3f372ed956c63c6508381.tar.xz
Change: Use GUITimer class instead of bare int/uints.
Diffstat (limited to 'src/toolbar_gui.cpp')
-rw-r--r--src/toolbar_gui.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 4f0f14011..cd0f518df 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -48,6 +48,7 @@
#include "story_base.h"
#include "toolbar_gui.h"
#include "framerate_type.h"
+#include "guitimer_func.h"
#include "widgets/toolbar_widget.h"
@@ -1978,7 +1979,7 @@ enum MainToolbarHotkeys {
/** Main toolbar. */
struct MainToolbarWindow : Window {
- int timer;
+ GUITimer timer;
MainToolbarWindow(WindowDesc *desc) : Window(desc)
{
@@ -1991,7 +1992,7 @@ struct MainToolbarWindow : Window {
PositionMainToolbar(this);
DoZoomInOutWindow(ZOOM_NONE, this);
- this->timer = MILLISECONDS_PER_TICK;
+ this->timer.SetInterval(MILLISECONDS_PER_TICK);
}
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
@@ -2098,8 +2099,8 @@ struct MainToolbarWindow : Window {
virtual void OnRealtimeTick(uint delta_ms)
{
- if (!TimerElapsed(this->timer, delta_ms)) return;
- this->timer = MILLISECONDS_PER_TICK;
+ if (!this->timer.Elapsed(delta_ms)) return;
+ this->timer.SetInterval(MILLISECONDS_PER_TICK);
if (this->IsWidgetLowered(WID_TN_PAUSE) != !!_pause_mode) {
this->ToggleWidgetLoweredState(WID_TN_PAUSE);
@@ -2317,7 +2318,7 @@ enum MainToolbarEditorHotkeys {
};
struct ScenarioEditorToolbarWindow : Window {
- int timer;
+ GUITimer timer;
ScenarioEditorToolbarWindow(WindowDesc *desc) : Window(desc)
{
@@ -2328,7 +2329,7 @@ struct ScenarioEditorToolbarWindow : Window {
PositionMainToolbar(this);
DoZoomInOutWindow(ZOOM_NONE, this);
- this->timer = MILLISECONDS_PER_TICK;
+ this->timer.SetInterval(MILLISECONDS_PER_TICK);
}
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
@@ -2458,8 +2459,8 @@ struct ScenarioEditorToolbarWindow : Window {
virtual void OnRealtimeTick(uint delta_ms)
{
- if (!TimerElapsed(this->timer, delta_ms)) return;
- this->timer = MILLISECONDS_PER_TICK;
+ if (!this->timer.Elapsed(delta_ms)) return;
+ this->timer.SetInterval(MILLISECONDS_PER_TICK);
if (this->IsWidgetLowered(WID_TE_PAUSE) != !!_pause_mode) {
this->ToggleWidgetLoweredState(WID_TE_PAUSE);