mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Declare all IntervalTimers const, which can be const.
parent
61cec33be2
commit
0d5b3ebd7f
|
@ -575,7 +575,7 @@ public:
|
|||
CheckRedrawStationCoverage(this);
|
||||
}
|
||||
|
||||
IntervalTimer<TimerGameCalendar> yearly_interval = {{TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
const IntervalTimer<TimerGameCalendar> yearly_interval = {{TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
this->InvalidateData();
|
||||
}};
|
||||
};
|
||||
|
|
|
@ -635,7 +635,7 @@ struct CheatWindow : Window {
|
|||
this->SetDirty();
|
||||
}
|
||||
|
||||
IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::MONTH, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
const IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::MONTH, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
this->SetDirty();
|
||||
}};
|
||||
};
|
||||
|
|
|
@ -812,7 +812,7 @@ void OnTick_Companies()
|
|||
* A year has passed, update the economic data of all companies, and perhaps show the
|
||||
* financial overview window of the local company.
|
||||
*/
|
||||
static IntervalTimer<TimerGameEconomy> _economy_companies_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::COMPANY}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_companies_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::COMPANY}, [](auto)
|
||||
{
|
||||
/* Copy statistics */
|
||||
for (Company *c : Company::Iterate()) {
|
||||
|
|
|
@ -540,7 +540,7 @@ struct CompanyFinancesWindow : Window {
|
|||
* Check on a regular interval if the maximum amount of money has changed.
|
||||
* If it has, rescale the window to fit the new amount.
|
||||
*/
|
||||
IntervalTimer<TimerWindow> rescale_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> rescale_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const Company *c = Company::Get(this->window_number);
|
||||
if (c->money > CompanyFinancesWindow::max_money) {
|
||||
CompanyFinancesWindow::max_money = std::max(c->money * 2, CompanyFinancesWindow::max_money * 4);
|
||||
|
@ -1991,7 +1991,7 @@ struct CompanyInfrastructureWindow : Window
|
|||
}
|
||||
}
|
||||
|
||||
IntervalTimer<TimerWindow> redraw_interval = {std::chrono::seconds(1), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> redraw_interval = {std::chrono::seconds(1), [this](auto) {
|
||||
this->UpdateInfrastructureList();
|
||||
this->SetWidgetDirty(WID_CI_LIST);
|
||||
}};
|
||||
|
@ -2433,7 +2433,7 @@ struct CompanyWindow : Window
|
|||
}
|
||||
|
||||
/** Redraw the window on a regular interval. */
|
||||
IntervalTimer<TimerWindow> redraw_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> redraw_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
this->SetDirty();
|
||||
}};
|
||||
|
||||
|
@ -2579,7 +2579,7 @@ struct BuyCompanyWindow : Window {
|
|||
/**
|
||||
* Check on a regular interval if the company value has changed.
|
||||
*/
|
||||
IntervalTimer<TimerWindow> rescale_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> rescale_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
/* Value can't change when in bankruptcy. */
|
||||
if (!this->hostile_takeover) return;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ static uint _script_current_depth; ///< Depth of scripts running (used to abort
|
|||
static std::string _scheduled_monthly_script; ///< Script scheduled to execute by the 'schedule' console command (empty if no script is scheduled).
|
||||
|
||||
/** Timer that runs every month of game time for the 'schedule' console command. */
|
||||
static IntervalTimer<TimerGameCalendar> _scheduled_monthly_timer = {{TimerGameCalendar::MONTH, TimerGameCalendar::Priority::NONE}, [](auto) {
|
||||
static const IntervalTimer<TimerGameCalendar> _scheduled_monthly_timer = {{TimerGameCalendar::MONTH, TimerGameCalendar::Priority::NONE}, [](auto) {
|
||||
if (_scheduled_monthly_script.empty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ struct IConsoleWindow : Window
|
|||
}
|
||||
|
||||
/** Check on a regular interval if the console buffer needs truncating. */
|
||||
IntervalTimer<TimerWindow> truncate_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> truncate_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
assert(this->height >= 0 && this->line_height > 0);
|
||||
size_t visible_lines = static_cast<size_t>(this->height / this->line_height);
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ uint64_t GetMaskOfAllowedCurrencies()
|
|||
/**
|
||||
* Verify if the currency chosen by the user is about to be converted to Euro
|
||||
*/
|
||||
static IntervalTimer<TimerGameCalendar> _check_switch_to_euro({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameCalendar> _check_switch_to_euro({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
|
||||
{
|
||||
if (_currency_specs[_settings_game.locale.currency].to_euro != CF_NOEURO &&
|
||||
_currency_specs[_settings_game.locale.currency].to_euro != CF_ISEURO &&
|
||||
|
|
|
@ -940,7 +940,7 @@ static void ResetDisasterDelay()
|
|||
_disaster_delay = GB(Random(), 0, 9) + 730;
|
||||
}
|
||||
|
||||
static IntervalTimer<TimerGameEconomy> _economy_disaster_daily({TimerGameEconomy::DAY, TimerGameEconomy::Priority::DISASTER}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_disaster_daily({TimerGameEconomy::DAY, TimerGameEconomy::Priority::DISASTER}, [](auto)
|
||||
{
|
||||
if (--_disaster_delay != 0) return;
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ public:
|
|||
CheckRedrawStationCoverage(this);
|
||||
}
|
||||
|
||||
IntervalTimer<TimerGameCalendar> yearly_interval = {{TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
const IntervalTimer<TimerGameCalendar> yearly_interval = {{TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
this->InvalidateData();
|
||||
}};
|
||||
};
|
||||
|
|
|
@ -293,7 +293,7 @@ struct DropdownWindow : Window {
|
|||
}
|
||||
|
||||
/** Rate limit how fast scrolling happens. */
|
||||
IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(30), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(30), [this](auto) {
|
||||
if (this->scrolling == 0) return;
|
||||
|
||||
if (this->vscroll->UpdatePosition(this->scrolling)) this->SetDirty();
|
||||
|
|
|
@ -1969,7 +1969,7 @@ void LoadUnloadStation(Station *st)
|
|||
/**
|
||||
* Every calendar month update of inflation.
|
||||
*/
|
||||
static IntervalTimer<TimerGameCalendar> _calendar_inflation_monthly({TimerGameCalendar::MONTH, TimerGameCalendar::Priority::COMPANY}, [](auto)
|
||||
static const IntervalTimer<TimerGameCalendar> _calendar_inflation_monthly({TimerGameCalendar::MONTH, TimerGameCalendar::Priority::COMPANY}, [](auto)
|
||||
{
|
||||
if (_settings_game.economy.inflation) {
|
||||
AddInflation();
|
||||
|
@ -1980,7 +1980,7 @@ static IntervalTimer<TimerGameCalendar> _calendar_inflation_monthly({TimerGameCa
|
|||
/**
|
||||
* Every economy month update of company economic data, plus economy fluctuations.
|
||||
*/
|
||||
static IntervalTimer<TimerGameEconomy> _economy_companies_monthly({ TimerGameEconomy::MONTH, TimerGameEconomy::Priority::COMPANY }, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_companies_monthly({ TimerGameEconomy::MONTH, TimerGameEconomy::Priority::COMPANY }, [](auto)
|
||||
{
|
||||
CompaniesGenStatistics();
|
||||
CompaniesPayInterest();
|
||||
|
|
|
@ -959,7 +959,7 @@ static bool IsVehicleTypeDisabled(VehicleType type, bool ai)
|
|||
}
|
||||
|
||||
/** Daily check to offer an exclusive engine preview to the companies. */
|
||||
static IntervalTimer<TimerGameCalendar> _calendar_engines_daily({TimerGameCalendar::DAY, TimerGameCalendar::Priority::ENGINE}, [](auto)
|
||||
static const IntervalTimer<TimerGameCalendar> _calendar_engines_daily({TimerGameCalendar::DAY, TimerGameCalendar::Priority::ENGINE}, [](auto)
|
||||
{
|
||||
for (Company *c : Company::Iterate()) {
|
||||
c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes, TimerGameCalendar::date);
|
||||
|
@ -1192,7 +1192,7 @@ void CalendarEnginesMonthlyLoop()
|
|||
}
|
||||
}
|
||||
|
||||
static IntervalTimer<TimerGameCalendar> _calendar_engines_monthly({TimerGameCalendar::MONTH, TimerGameCalendar::Priority::ENGINE}, [](auto)
|
||||
static const IntervalTimer<TimerGameCalendar> _calendar_engines_monthly({TimerGameCalendar::MONTH, TimerGameCalendar::Priority::ENGINE}, [](auto)
|
||||
{
|
||||
CalendarEnginesMonthlyLoop();
|
||||
});
|
||||
|
|
|
@ -457,7 +457,7 @@ struct FramerateWindow : Window {
|
|||
}
|
||||
|
||||
/** Update the window on a regular interval. */
|
||||
IntervalTimer<TimerWindow> update_interval = {std::chrono::milliseconds(100), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> update_interval = {std::chrono::milliseconds(100), [this](auto) {
|
||||
this->UpdateData();
|
||||
this->SetDirty();
|
||||
}};
|
||||
|
@ -838,7 +838,7 @@ struct FrametimeGraphWindow : Window {
|
|||
}
|
||||
|
||||
/** Update the scaling on a regular interval. */
|
||||
IntervalTimer<TimerWindow> update_interval = {std::chrono::milliseconds(500), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> update_interval = {std::chrono::milliseconds(500), [this](auto) {
|
||||
this->UpdateScale();
|
||||
}};
|
||||
|
||||
|
|
|
@ -1212,7 +1212,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
|
|||
}
|
||||
|
||||
/** Update the payment rates on a regular interval. */
|
||||
IntervalTimer<TimerWindow> update_payment_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> update_payment_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
this->UpdatePaymentRates();
|
||||
}};
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ void ShowEndGameChart()
|
|||
new EndGameWindow(_endgame_desc);
|
||||
}
|
||||
|
||||
static IntervalTimer<TimerGameCalendar> _check_end_game({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameCalendar> _check_end_game({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
|
||||
{
|
||||
/* 0 = never */
|
||||
if (_settings_game.game_creation.ending_year == 0) return;
|
||||
|
|
|
@ -3001,7 +3001,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
|
|||
* For small maps, it implies that less than one change per month is required, while on bigger maps,
|
||||
* it would be way more. The daily loop handles those changes.
|
||||
*/
|
||||
static IntervalTimer<TimerGameEconomy> _economy_industries_daily({TimerGameEconomy::DAY, TimerGameEconomy::Priority::INDUSTRY}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_industries_daily({TimerGameEconomy::DAY, TimerGameEconomy::Priority::INDUSTRY}, [](auto)
|
||||
{
|
||||
_economy.industry_daily_change_counter += _economy.industry_daily_increment;
|
||||
|
||||
|
@ -3043,7 +3043,7 @@ static IntervalTimer<TimerGameEconomy> _economy_industries_daily({TimerGameEcono
|
|||
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_PRODUCTION_CHANGE);
|
||||
});
|
||||
|
||||
static IntervalTimer<TimerGameEconomy> _economy_industries_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::INDUSTRY}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_industries_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::INDUSTRY}, [](auto)
|
||||
{
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE);
|
||||
|
||||
|
|
|
@ -737,7 +737,7 @@ public:
|
|||
if (success && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
}
|
||||
|
||||
IntervalTimer<TimerWindow> update_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> update_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
if (_game_mode == GM_EDITOR) return;
|
||||
if (this->selected_type == IT_INVALID) return;
|
||||
|
||||
|
@ -1872,7 +1872,7 @@ public:
|
|||
}
|
||||
|
||||
/** Rebuild the industry list on a regular interval. */
|
||||
IntervalTimer<TimerWindow> rebuild_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> rebuild_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
this->industries.ForceResort();
|
||||
this->BuildSortIndustriesList();
|
||||
}};
|
||||
|
|
|
@ -238,7 +238,7 @@ struct MainWindow : Window
|
|||
}
|
||||
|
||||
/** Refresh the link-graph overlay on a regular interval. */
|
||||
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(7650), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(7650), [this](auto) {
|
||||
RefreshLinkGraph();
|
||||
}};
|
||||
|
||||
|
|
|
@ -465,7 +465,7 @@ struct AboutWindow : public Window {
|
|||
*
|
||||
* The interval of 2100ms is chosen to maintain parity: 2100 / GetCharacterHeight(FS_NORMAL) = 150ms.
|
||||
*/
|
||||
IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(2100) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
|
||||
const IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(2100) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
|
||||
this->text_position -= count;
|
||||
/* If the last text has scrolled start a new from the start */
|
||||
if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - std::size(_credits) * this->line_height)) {
|
||||
|
|
|
@ -165,7 +165,7 @@ void NetworkUndrawChatMessage()
|
|||
}
|
||||
|
||||
/** Check if a message is expired on a regular interval. */
|
||||
static IntervalTimer<TimerWindow> network_message_expired_interval(std::chrono::seconds(1), [](auto) {
|
||||
static const IntervalTimer<TimerWindow> network_message_expired_interval(std::chrono::seconds(1), [](auto) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
for (auto &cmsg : _chatmsg_list) {
|
||||
/* Message has expired, remove from the list */
|
||||
|
|
|
@ -833,7 +833,7 @@ public:
|
|||
}
|
||||
|
||||
/** Refresh the online servers on a regular interval. */
|
||||
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::seconds(30), [this](uint) {
|
||||
const IntervalTimer<TimerWindow> refresh_interval = {std::chrono::seconds(30), [this](uint) {
|
||||
if (!this->searched_internet) return;
|
||||
|
||||
_network_coordinator_client.GetListing();
|
||||
|
|
|
@ -1864,14 +1864,14 @@ static void NetworkCheckRestartMapYear()
|
|||
}
|
||||
|
||||
/** Calendar yearly "callback". Called whenever the calendar year changes. */
|
||||
static IntervalTimer<TimerGameCalendar> _calendar_network_yearly({ TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE }, [](auto) {
|
||||
static const IntervalTimer<TimerGameCalendar> _calendar_network_yearly({ TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE }, [](auto) {
|
||||
if (!_network_server) return;
|
||||
|
||||
NetworkCheckRestartMapYear();
|
||||
});
|
||||
|
||||
/** Economy yearly "callback". Called whenever the economy year changes. */
|
||||
static IntervalTimer<TimerGameEconomy> _economy_network_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_network_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
{
|
||||
if (!_network_server) return;
|
||||
|
||||
|
@ -1879,7 +1879,7 @@ static IntervalTimer<TimerGameEconomy> _economy_network_yearly({TimerGameEconomy
|
|||
});
|
||||
|
||||
/** Quarterly "callback". Called whenever the economy quarter changes. */
|
||||
static IntervalTimer<TimerGameEconomy> _network_quarterly({TimerGameEconomy::QUARTER, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _network_quarterly({TimerGameEconomy::QUARTER, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
{
|
||||
if (!_network_server) return;
|
||||
|
||||
|
@ -1888,7 +1888,7 @@ static IntervalTimer<TimerGameEconomy> _network_quarterly({TimerGameEconomy::QUA
|
|||
});
|
||||
|
||||
/** Economy monthly "callback". Called whenever the economy month changes. */
|
||||
static IntervalTimer<TimerGameEconomy> _network_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _network_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
{
|
||||
if (!_network_server) return;
|
||||
|
||||
|
@ -1897,7 +1897,7 @@ static IntervalTimer<TimerGameEconomy> _network_monthly({TimerGameEconomy::MONTH
|
|||
});
|
||||
|
||||
/** Economy weekly "callback". Called whenever the economy week changes. */
|
||||
static IntervalTimer<TimerGameEconomy> _network_weekly({TimerGameEconomy::WEEK, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _network_weekly({TimerGameEconomy::WEEK, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
{
|
||||
if (!_network_server) return;
|
||||
|
||||
|
@ -1905,7 +1905,7 @@ static IntervalTimer<TimerGameEconomy> _network_weekly({TimerGameEconomy::WEEK,
|
|||
});
|
||||
|
||||
/** Daily "callback". Called whenever the economy date changes. */
|
||||
static IntervalTimer<TimerGameEconomy> _economy_network_daily({TimerGameEconomy::DAY, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_network_daily({TimerGameEconomy::DAY, TimerGameEconomy::Priority::NONE}, [](auto)
|
||||
{
|
||||
if (!_network_server) return;
|
||||
|
||||
|
|
|
@ -652,7 +652,7 @@ struct NewsWindow : Window {
|
|||
*
|
||||
* The interval of 210ms is chosen to maintain 15ms at normal zoom: 210 / GetCharacterHeight(FS_NORMAL) = 15ms.
|
||||
*/
|
||||
IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(210) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
|
||||
const IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(210) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
|
||||
int newtop = std::max(this->top - 2 * static_cast<int>(count), _screen.height - this->height - this->status_height - this->chat_height);
|
||||
this->SetWindowTop(newtop);
|
||||
}};
|
||||
|
|
|
@ -222,11 +222,11 @@ private:
|
|||
|
||||
GUIBadgeClasses badge_classes;
|
||||
|
||||
IntervalTimer<TimerGameCalendar> yearly_interval = {{TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
const IntervalTimer<TimerGameCalendar> yearly_interval = {{TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
this->SetDirty();
|
||||
}};
|
||||
|
||||
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> refresh_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
RefreshUsedTypeList();
|
||||
}};
|
||||
};
|
||||
|
|
|
@ -2002,7 +2002,7 @@ void ResetSignalVariant(int32_t)
|
|||
}
|
||||
}
|
||||
|
||||
static IntervalTimer<TimerGameCalendar> _check_reset_signal({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
|
||||
static const IntervalTimer<TimerGameCalendar> _check_reset_signal({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
|
||||
{
|
||||
if (TimerGameCalendar::year != _settings_client.gui.semaphore_build_before) return;
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ struct SignListWindow : Window, SignList {
|
|||
}
|
||||
|
||||
/** Resort the sign listing on a regular interval. */
|
||||
IntervalTimer<TimerWindow> rebuild_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> rebuild_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
this->BuildSortSignList();
|
||||
this->SetDirty();
|
||||
}};
|
||||
|
|
|
@ -730,12 +730,12 @@ protected:
|
|||
}
|
||||
|
||||
/** Blink the industries (if selected) on a regular interval. */
|
||||
IntervalTimer<TimerWindow> blink_interval = {std::chrono::milliseconds(450), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> blink_interval = {std::chrono::milliseconds(450), [this](auto) {
|
||||
Blink();
|
||||
}};
|
||||
|
||||
/** Update the whole map on a regular interval. */
|
||||
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(930), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(930), [this](auto) {
|
||||
ForceRefresh();
|
||||
}};
|
||||
|
||||
|
|
|
@ -4226,7 +4226,7 @@ void OnTick_Station()
|
|||
}
|
||||
|
||||
/** Economy monthly loop for stations. */
|
||||
static IntervalTimer<TimerGameEconomy> _economy_stations_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::STATION}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_stations_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::STATION}, [](auto)
|
||||
{
|
||||
for (Station *st : Station::Iterate()) {
|
||||
for (GoodsEntry &ge : st->goods) {
|
||||
|
|
|
@ -192,7 +192,7 @@ struct StatusBarWindow : Window {
|
|||
}
|
||||
|
||||
/** Move information on the ticker slowly from one side to the other. */
|
||||
IntervalTimer<TimerWindow> ticker_scroll_interval = {std::chrono::milliseconds(15), [this](uint count) {
|
||||
const IntervalTimer<TimerWindow> ticker_scroll_interval = {std::chrono::milliseconds(15), [this](uint count) {
|
||||
if (_pause_mode.Any()) return;
|
||||
|
||||
if (this->ticker_scroll < TICKER_STOP) {
|
||||
|
@ -205,7 +205,7 @@ struct StatusBarWindow : Window {
|
|||
this->SetWidgetDirty(WID_S_MIDDLE);
|
||||
}};
|
||||
|
||||
IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::DAY, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
const IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::DAY, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
this->SetWidgetDirty(WID_S_LEFT);
|
||||
}};
|
||||
};
|
||||
|
|
|
@ -422,7 +422,7 @@ bool FindSubsidyCargoDestination(CargoType cargo_type, Source src)
|
|||
}
|
||||
|
||||
/** Perform the economy monthly update of open subsidies, and try to create a new one. */
|
||||
static IntervalTimer<TimerGameEconomy> _economy_subsidies_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::SUBSIDY}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_subsidies_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::SUBSIDY}, [](auto)
|
||||
{
|
||||
bool modified = false;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ void RemoveTextEffect(TextEffectID te_id)
|
|||
}
|
||||
|
||||
/** Slowly move text effects upwards. */
|
||||
IntervalTimer<TimerWindow> move_all_text_effects_interval = {std::chrono::milliseconds(30), [](uint count) {
|
||||
const IntervalTimer<TimerWindow> move_all_text_effects_interval = {std::chrono::milliseconds(30), [](uint count) {
|
||||
if (_pause_mode.Any() && _game_mode != GM_EDITOR && _settings_game.construction.command_pause_level <= CMDPL_NO_CONSTRUCTION) return;
|
||||
|
||||
for (TextEffect &te : _text_effects) {
|
||||
|
|
|
@ -802,7 +802,7 @@ struct TimetableWindow : Window {
|
|||
/**
|
||||
* In real-time mode, the timetable GUI shows relative times and needs to be redrawn every second.
|
||||
*/
|
||||
IntervalTimer<TimerGameTick> redraw_interval = { { TimerGameTick::Priority::NONE, Ticks::TICKS_PER_SECOND }, [this](auto) {
|
||||
const IntervalTimer<TimerGameTick> redraw_interval = { { TimerGameTick::Priority::NONE, Ticks::TICKS_PER_SECOND }, [this](auto) {
|
||||
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||
this->SetDirty();
|
||||
}
|
||||
|
|
|
@ -2104,7 +2104,7 @@ struct MainToolbarWindow : Window {
|
|||
}
|
||||
|
||||
/** Refresh the state of pause / game-speed on a regular interval.*/
|
||||
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(30), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(30), [this](auto) {
|
||||
if (this->IsWidgetLowered(WID_TN_PAUSE) != _pause_mode.Any()) {
|
||||
this->ToggleWidgetLoweredState(WID_TN_PAUSE);
|
||||
this->SetWidgetDirty(WID_TN_PAUSE);
|
||||
|
@ -2471,7 +2471,7 @@ struct ScenarioEditorToolbarWindow : Window {
|
|||
}
|
||||
|
||||
/** Refresh the state of pause / game-speed on a regular interval.*/
|
||||
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(30), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(30), [this](auto) {
|
||||
if (this->IsWidgetLowered(WID_TE_PAUSE) != _pause_mode.Any()) {
|
||||
this->ToggleWidgetLoweredState(WID_TE_PAUSE);
|
||||
this->SetDirty();
|
||||
|
|
|
@ -4040,7 +4040,7 @@ CommandCost CheckforTownRating(DoCommandFlags flags, Town *t, TownRatingCheckTyp
|
|||
return CommandCost();
|
||||
}
|
||||
|
||||
static IntervalTimer<TimerGameEconomy> _economy_towns_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::TOWN}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_towns_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::TOWN}, [](auto)
|
||||
{
|
||||
for (Town *t : Town::Iterate()) {
|
||||
/* Check for active town actions and decrement their counters. */
|
||||
|
@ -4067,7 +4067,7 @@ static IntervalTimer<TimerGameEconomy> _economy_towns_monthly({TimerGameEconomy:
|
|||
}
|
||||
});
|
||||
|
||||
static IntervalTimer<TimerGameEconomy> _economy_towns_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::TOWN}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_towns_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::TOWN}, [](auto)
|
||||
{
|
||||
/* Increment house ages */
|
||||
for (const auto t : Map::Iterate()) {
|
||||
|
|
|
@ -332,7 +332,7 @@ public:
|
|||
}
|
||||
|
||||
/** Redraw the whole window on a regular interval. */
|
||||
IntervalTimer<TimerWindow> redraw_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> redraw_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
this->SetDirty();
|
||||
}};
|
||||
|
||||
|
@ -605,7 +605,7 @@ public:
|
|||
Command<CMD_RENAME_TOWN>::Post(STR_ERROR_CAN_T_RENAME_TOWN, static_cast<TownID>(this->window_number), *str);
|
||||
}
|
||||
|
||||
IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::DAY, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
const IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::DAY, TimerGameCalendar::Priority::NONE}, [this](auto) {
|
||||
/* Refresh after possible snowline change */
|
||||
this->SetDirty();
|
||||
}};
|
||||
|
@ -987,7 +987,7 @@ public:
|
|||
}
|
||||
|
||||
/** Redraw the whole window on a regular interval. */
|
||||
IntervalTimer<TimerWindow> rebuild_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> rebuild_interval = {std::chrono::seconds(3), [this](auto) {
|
||||
this->BuildSortTownList();
|
||||
this->SetDirty();
|
||||
}};
|
||||
|
@ -1775,7 +1775,7 @@ struct BuildHouseWindow : public PickerWindow {
|
|||
Command<CMD_PLACE_HOUSE>::Post(STR_ERROR_CAN_T_BUILD_HOUSE, CcPlaySound_CONSTRUCTION_OTHER, tile, spec->Index(), this->house_protected);
|
||||
}
|
||||
|
||||
IntervalTimer<TimerWindow> view_refresh_interval = {std::chrono::milliseconds(2500), [this](auto) {
|
||||
const IntervalTimer<TimerWindow> view_refresh_interval = {std::chrono::milliseconds(2500), [this](auto) {
|
||||
/* There are four different 'views' that are random based on house tile position. As this is not
|
||||
* user-controllable, instead we automatically cycle through them. */
|
||||
HousePickerCallbacks::sel_view = (HousePickerCallbacks::sel_view + 1) % 4;
|
||||
|
|
|
@ -2987,7 +2987,7 @@ void Vehicle::RemoveFromShared()
|
|||
this->previous_shared = nullptr;
|
||||
}
|
||||
|
||||
static IntervalTimer<TimerGameEconomy> _economy_vehicles_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::VEHICLE}, [](auto)
|
||||
static const IntervalTimer<TimerGameEconomy> _economy_vehicles_yearly({TimerGameEconomy::YEAR, TimerGameEconomy::Priority::VEHICLE}, [](auto)
|
||||
{
|
||||
for (Vehicle *v : Vehicle::Iterate()) {
|
||||
if (v->IsPrimaryVehicle()) {
|
||||
|
|
|
@ -3068,7 +3068,7 @@ void CallWindowRealtimeTickEvent(uint delta_ms)
|
|||
}
|
||||
|
||||
/** Update various of window-related information on a regular interval. */
|
||||
static IntervalTimer<TimerWindow> window_interval(std::chrono::milliseconds(30), [](auto) {
|
||||
static const IntervalTimer<TimerWindow> window_interval(std::chrono::milliseconds(30), [](auto) {
|
||||
extern int _caret_timer;
|
||||
_caret_timer += 3;
|
||||
CursorTick();
|
||||
|
@ -3079,12 +3079,12 @@ static IntervalTimer<TimerWindow> window_interval(std::chrono::milliseconds(30),
|
|||
});
|
||||
|
||||
/** Blink the window highlight colour constantly. */
|
||||
static IntervalTimer<TimerWindow> highlight_interval(std::chrono::milliseconds(450), [](auto) {
|
||||
static const IntervalTimer<TimerWindow> highlight_interval(std::chrono::milliseconds(450), [](auto) {
|
||||
_window_highlight_colour = !_window_highlight_colour;
|
||||
});
|
||||
|
||||
/** Blink all windows marked with a white border. */
|
||||
static IntervalTimer<TimerWindow> white_border_interval(std::chrono::milliseconds(30), [](auto) {
|
||||
static const IntervalTimer<TimerWindow> white_border_interval(std::chrono::milliseconds(30), [](auto) {
|
||||
if (_network_dedicated) return;
|
||||
|
||||
for (Window *w : Window::Iterate()) {
|
||||
|
|
Loading…
Reference in New Issue