summaryrefslogtreecommitdiff
path: root/src/news_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/news_gui.cpp
parent59fe4f28c8f0bf47e7af40095dc6fba145188930 (diff)
downloadopenttd-806e7d25dddcc8b0e9c3f372ed956c63c6508381.tar.xz
Change: Use GUITimer class instead of bare int/uints.
Diffstat (limited to 'src/news_gui.cpp')
-rw-r--r--src/news_gui.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 183b27b90..b79418c89 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -33,6 +33,7 @@
#include "command_func.h"
#include "company_base.h"
#include "settings_internal.h"
+#include "guitimer_func.h"
#include "widgets/news_widget.h"
@@ -262,7 +263,7 @@ struct NewsWindow : Window {
const NewsItem *ni; ///< News item to display.
static int duration; ///< Remaining time for showing the current news message (may only be access while a news item is displayed).
- uint timer;
+ GUITimer timer;
NewsWindow(WindowDesc *desc, const NewsItem *ni) : Window(desc), ni(ni)
{
@@ -273,6 +274,8 @@ struct NewsWindow : Window {
this->flags |= WF_DISABLE_VP_SCROLL;
+ this->timer.SetInterval(15);
+
this->CreateNestedTree();
/* For company news with a face we have a separate headline in param[0] */
@@ -489,7 +492,7 @@ struct NewsWindow : Window {
virtual void OnRealtimeTick(uint delta_ms)
{
- int count = CountIntervalElapsed(this->timer, delta_ms, 15);
+ int count = this->timer.CountElapsed(delta_ms);
if (count > 0) {
/* Scroll up newsmessages from the bottom */
int newtop = max(this->top - 2 * count, _screen.height - this->height - this->status_height - this->chat_height);