OregonCore  revision 3611e8a-git
Your Favourite TBC server
IntervalTimer Class Reference

#include <Timer.h>

Public Member Functions

 IntervalTimer ()
 
void Update (time_t diff)
 
bool Passed ()
 
void Reset ()
 
void SetCurrent (time_t current)
 
void SetInterval (time_t interval)
 
time_t GetInterval () const
 
time_t GetCurrent () const
 

Private Attributes

time_t _interval
 
time_t _current
 

Detailed Description

Definition at line 99 of file Timer.h.

Constructor & Destructor Documentation

IntervalTimer::IntervalTimer ( )
inline

Definition at line 102 of file Timer.h.

102 : _interval(0), _current(0) {}
time_t _interval
Definition: Timer.h:137
time_t _current
Definition: Timer.h:138

Member Function Documentation

time_t IntervalTimer::GetCurrent ( ) const
inline

Definition at line 130 of file Timer.h.

References _current.

Referenced by Weather::Update(), and MapManager::Update().

131  {
132  return _current;
133  }
time_t _current
Definition: Timer.h:138
time_t IntervalTimer::GetInterval ( ) const
inline

Definition at line 126 of file Timer.h.

References _interval.

Referenced by World::Update(), and Weather::Weather().

127  {
128  return _interval;
129  }
time_t _interval
Definition: Timer.h:137
bool IntervalTimer::Passed ( )
inline

Definition at line 109 of file Timer.h.

References _current, and _interval.

Referenced by Weather::Update(), MapManager::Update(), and World::Update().

110  {
111  return _current >= _interval;
112  }
time_t _interval
Definition: Timer.h:137
time_t _current
Definition: Timer.h:138
void IntervalTimer::Reset ( )
inline

Definition at line 113 of file Timer.h.

References _current, and _interval.

Referenced by World::ForceGameEventUpdate(), World::LoadConfigSettings(), MapManager::SetMapUpdateInterval(), Weather::Update(), and World::Update().

114  {
116  }
time_t _interval
Definition: Timer.h:137
time_t _current
Definition: Timer.h:138
void IntervalTimer::SetCurrent ( time_t  current)
inline

Definition at line 118 of file Timer.h.

References _current.

Referenced by Weather::Update(), MapManager::Update(), and World::Update().

119  {
120  _current = current;
121  }
time_t _current
Definition: Timer.h:138
void IntervalTimer::SetInterval ( time_t  interval)
inline
void IntervalTimer::Update ( time_t  diff)
inline

Definition at line 104 of file Timer.h.

References _current.

Referenced by Weather::Update(), MapManager::Update(), and World::Update().

105  {
106  _current += diff;
107  if (_current < 0) _current = 0;
108  }
time_t _current
Definition: Timer.h:138

Member Data Documentation

time_t IntervalTimer::_current
private

Definition at line 138 of file Timer.h.

Referenced by GetCurrent(), Passed(), Reset(), SetCurrent(), and Update().

time_t IntervalTimer::_interval
private

Definition at line 137 of file Timer.h.

Referenced by GetInterval(), Passed(), Reset(), and SetInterval().


The documentation for this class was generated from the following file: