14#include "../openttd.h"
18#include "../safeguards.h"
23 if (this->period.period == std::chrono::milliseconds::zero())
return;
27 this->storage.elapsed += delta;
30 while (this->storage.elapsed >= this->period.period) {
31 this->storage.elapsed -= this->period.period;
36 this->callback(count);
43 if (this->fired)
return;
44 if (this->period.period == std::chrono::milliseconds::zero())
return;
48 this->storage.elapsed += delta;
50 if (this->storage.elapsed >= this->period.period) {
60 timer->Elapsed(delta);
void Elapsed(TElapsed count) override
Called by the timer manager to notify the timer that the given amount of time has elapsed.
void Elapsed(TElapsed count) override
Called by the timer manager to notify the timer that the given amount of time has elapsed.
Timer that represents real time for game-related purposes.
@ UNPAUSED
Only run when not paused.
@ AUTOSAVE
Only run when not paused or there was a Command executed recently.
The TimerManager manages a single Timer-type.
static bool Elapsed(TElapsed value)
Called when time for this timer elapsed.
PauseMode _pause_mode
The current pause mode.
@ PM_COMMAND_DURING_PAUSE
A game paused, and a command executed during the pause; resets on autosave.
@ PM_UNPAUSED
A normal unpaused game.
Definition of Interval and OneShot timers.
Definition of the real time game-timer.