OpenTTD Source 20241224-master-gee860a5c8e
|
The base where every other type of timer is derived from. More...
#include <timer.h>
Public Types | |
using | TPeriod = typename TTimerType::TPeriod |
using | TElapsed = typename TTimerType::TElapsed |
using | TStorage = typename TTimerType::TStorage |
Public Member Functions | |
BaseTimer (const TPeriod period) | |
Create a new timer. | |
virtual | ~BaseTimer () |
Delete the timer. | |
Data Fields | |
TPeriod | period |
The period of the timer. | |
TStorage | storage = {} |
The storage of the timer. | |
Protected Member Functions | |
virtual void | Elapsed (TElapsed delta)=0 |
Called by the timer manager to notify the timer that the given amount of time has elapsed. | |
Friends | |
class | TimerManager< TTimerType > |
The base where every other type of timer is derived from.
Never use this class directly yourself.
using BaseTimer< TTimerType >::TElapsed = typename TTimerType::TElapsed |
using BaseTimer< TTimerType >::TPeriod = typename TTimerType::TPeriod |
using BaseTimer< TTimerType >::TStorage = typename TTimerType::TStorage |
|
inline |
Create a new timer.
period | The period of the timer. |
Definition at line 33 of file timer.h.
References TimerManager< TTimerType >::RegisterTimer().
Delete the timer.
Definition at line 42 of file timer.h.
References TimerManager< TTimerType >::UnregisterTimer().
|
protectedpure virtual |
Called by the timer manager to notify the timer that the given amount of time has elapsed.
delta | Depending on the time type, this is either in milliseconds or in ticks. |
Implemented in IntervalTimer< TTimerType >, IntervalTimer< TimerGameCalendar >, IntervalTimer< TimerGameTick >, IntervalTimer< TimerWindow >, TimeoutTimer< TTimerType >, and TimeoutTimer< TimerWindow >.
|
friend |
TPeriod BaseTimer< TTimerType >::period |
The period of the timer.
Definition at line 49 of file timer.h.
Referenced by TimerManager< TTimerType >::ChangeRegisteredTimerPeriod(), and TimerManager< TTimerType >::RegisterTimer().
TStorage BaseTimer< TTimerType >::storage = {} |
The storage of the timer.
Definition at line 50 of file timer.h.
Referenced by AfterLoadGame(), TimeoutTimer< TTimerType >::Reset(), TimeoutTimer< TTimerType >::Reset(), and IntervalTimer< TTimerType >::SetInterval().