Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
This commit is contained in:

committed by
Patric Stout

parent
5e1bcee39b
commit
1ba4dcc924
@@ -32,11 +32,12 @@
|
||||
#include "../core/geometry_func.hpp"
|
||||
#include "../genworld.h"
|
||||
#include "../map_type.h"
|
||||
#include "../guitimer_func.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../sprite.h"
|
||||
#include "../settings_internal.h"
|
||||
#include "../company_cmd.h"
|
||||
#include "../timer/timer.h"
|
||||
#include "../timer/timer_window.h"
|
||||
|
||||
#include "../widgets/network_widget.h"
|
||||
|
||||
@@ -55,8 +56,6 @@
|
||||
|
||||
static void ShowNetworkStartServerWindow();
|
||||
|
||||
static const int NETWORK_LIST_REFRESH_DELAY = 30; ///< Time, in seconds, between updates of the network list.
|
||||
|
||||
static ClientID _admin_client_id = INVALID_CLIENT_ID; ///< For what client a confirmation window is open.
|
||||
static CompanyID _admin_company_id = INVALID_COMPANY; ///< For what company a confirmation window is open.
|
||||
|
||||
@@ -229,7 +228,6 @@ protected:
|
||||
Scrollbar *vscroll; ///< Vertical scrollbar of the list of servers.
|
||||
QueryString name_editbox; ///< Client name editbox.
|
||||
QueryString filter_editbox; ///< Editbox for filter on servers.
|
||||
GUITimer requery_timer; ///< Timer for network requery.
|
||||
bool searched_internet = false; ///< Did we ever press "Search Internet" button?
|
||||
|
||||
int lock_offset; ///< Left offset for lock icon.
|
||||
@@ -499,8 +497,6 @@ public:
|
||||
this->last_joined = NetworkAddServer(_settings_client.network.last_joined, false);
|
||||
this->server = this->last_joined;
|
||||
|
||||
this->requery_timer.SetInterval(NETWORK_LIST_REFRESH_DELAY * 1000);
|
||||
|
||||
this->servers.SetListing(this->last_sorting);
|
||||
this->servers.SetSortFuncs(this->sorter_funcs);
|
||||
this->servers.SetFilterFuncs(this->filter_funcs);
|
||||
@@ -891,14 +887,12 @@ public:
|
||||
this->vscroll->SetCapacityFromWidget(this, WID_NG_MATRIX);
|
||||
}
|
||||
|
||||
void OnRealtimeTick(uint delta_ms) override
|
||||
{
|
||||
/** Refresh the online servers on a regular interval. */
|
||||
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::seconds(30), [this](uint count) {
|
||||
if (!this->searched_internet) return;
|
||||
if (!this->requery_timer.Elapsed(delta_ms)) return;
|
||||
this->requery_timer.SetInterval(NETWORK_LIST_REFRESH_DELAY * 1000);
|
||||
|
||||
_network_coordinator_client.GetListing();
|
||||
}
|
||||
}};
|
||||
};
|
||||
|
||||
Listing NetworkGameWindow::last_sorting = {false, 5};
|
||||
|
Reference in New Issue
Block a user