summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2018-05-04 21:29:22 +0100
committerPeterN <peter@fuzzle.org>2019-01-11 11:56:21 +0000
commit2a8fa5fef9021bff67a13899832bf6f0a18e6ea1 (patch)
treec712f1973d6c74938e968f752a069b499dde7266 /src/main_gui.cpp
parent916e911806083a2fe06a79f6f10e275015079149 (diff)
downloadopenttd-2a8fa5fef9021bff67a13899832bf6f0a18e6ea1.tar.xz
Change: Split up Window::OnTick into OnGameTick and OnRealtimeTick. Adjust timers to work with milliseconds instead of ticks.
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 199546d43..12ee574bb 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -235,10 +235,11 @@ enum {
struct MainWindow : Window
{
- uint refresh;
+ int refresh;
- static const uint LINKGRAPH_REFRESH_PERIOD = 0xff;
- static const uint LINKGRAPH_DELAY = 0xf;
+ /* Refresh times in milliseconds */
+ static const uint LINKGRAPH_REFRESH_PERIOD = 7650;
+ static const uint LINKGRAPH_DELAY = 450;
MainWindow(WindowDesc *desc) : Window(desc)
{
@@ -253,9 +254,9 @@ struct MainWindow : Window
this->refresh = LINKGRAPH_DELAY;
}
- virtual void OnTick()
+ virtual void OnRealtimeTick(uint delta_ms)
{
- if (--this->refresh > 0) return;
+ if (!TimerElapsed(this->refresh, delta_ms)) return;
this->refresh = LINKGRAPH_REFRESH_PERIOD;