Codechange: migrate all game-time-related timers to the new framework

This commit is contained in:
Patric Stout
2023-04-13 13:56:00 +02:00
committed by Patric Stout
parent 1ba4dcc924
commit 3ebc7ad16e
25 changed files with 166 additions and 145 deletions

View File

@@ -47,6 +47,8 @@
#include "core/random_func.hpp"
#include "core/backup_type.hpp"
#include "landscape_cmd.h"
#include "timer/timer.h"
#include "timer/timer_game_calendar.h"
#include "table/strings.h"
@@ -935,14 +937,14 @@ static void ResetDisasterDelay()
_disaster_delay = GB(Random(), 0, 9) + 730;
}
void DisasterDailyLoop()
static IntervalTimer<TimerGameCalendar> _disaster_daily({TimerGameCalendar::DAY, TimerGameCalendar::Priority::DISASTER}, [](auto)
{
if (--_disaster_delay != 0) return;
ResetDisasterDelay();
if (_settings_game.difficulty.disasters != 0) DoDisaster();
}
});
void StartupDisasters()
{