20 if (this->period.period == std::chrono::milliseconds::zero())
return;
24 this->storage.elapsed += delta;
27 while (this->storage.elapsed >= this->period.period) {
28 this->storage.elapsed -= this->period.period;
33 this->callback(count);
40 if (this->fired)
return;
41 if (this->period.period == std::chrono::milliseconds::zero())
return;
45 this->storage.elapsed += delta;
47 if (this->storage.elapsed >= this->period.period) {
57 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.
@ Autosave
Only run when not paused or there was a Command executed recently.
@ Unpaused
Only run when not paused.
The TimerManager manages a single Timer-type.
static std::set< BaseTimer< TTimerType > *, base_timer_sorter > & GetTimers()
Singleton list, to store all the active timers.
static bool Elapsed(TElapsed value)
Called when time for this timer elapsed.
PauseModes _pause_mode
The current pause mode.
@ CommandDuringPause
A game paused, and a command executed during the pause; resets on autosave.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
Definition of Interval and OneShot timers.
Definition of the real time game-timer.