Change: Use GUITimer class instead of bare int/uints.

This commit is contained in:
2018-05-20 09:58:36 +01:00
committed by PeterN
parent 59fe4f28c8
commit 806e7d25dd
17 changed files with 140 additions and 85 deletions

View File

@@ -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);