TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PeriodicTimer Struct Reference

#include <Timer.h>

Public Member Functions

 PeriodicTimer (int32 period, int32 start_time)
 
bool Update (const uint32 diff)
 
void SetPeriodic (int32 period, int32 start_time)
 
void TUpdate (int32 diff)
 
bool TPassed () const
 
void TReset (int32 diff, int32 period)
 

Private Attributes

int32 i_period
 
int32 i_expireTime
 

Constructor & Destructor Documentation

PeriodicTimer::PeriodicTimer ( int32  period,
int32  start_time 
)
inline
173  : i_period(period), i_expireTime(start_time)
174  {
175  }
int32 i_period
Definition: Timer.h:199
int32 i_expireTime
Definition: Timer.h:200

Member Function Documentation

void PeriodicTimer::SetPeriodic ( int32  period,
int32  start_time 
)
inline
187  {
188  i_expireTime = start_time;
189  i_period = period;
190  }
int32 i_period
Definition: Timer.h:199
int32 i_expireTime
Definition: Timer.h:200
bool PeriodicTimer::TPassed ( ) const
inline
194 { return i_expireTime <= 0; }
int32 i_expireTime
Definition: Timer.h:200

+ Here is the caller graph for this function:

void PeriodicTimer::TReset ( int32  diff,
int32  period 
)
inline
195 { i_expireTime += period > diff ? period : diff; }
int32 i_expireTime
Definition: Timer.h:200

+ Here is the caller graph for this function:

void PeriodicTimer::TUpdate ( int32  diff)
inline
193 { i_expireTime -= diff; }
int32 i_expireTime
Definition: Timer.h:200

+ Here is the caller graph for this function:

bool PeriodicTimer::Update ( const uint32  diff)
inline
178  {
179  if ((i_expireTime -= diff) > 0)
180  return false;
181 
182  i_expireTime += i_period > int32(diff) ? i_period : diff;
183  return true;
184  }
int32 i_period
Definition: Timer.h:199
int32 i_expireTime
Definition: Timer.h:200
int32_t int32
Definition: g3dmath.h:167

Member Data Documentation

int32 PeriodicTimer::i_expireTime
private
int32 PeriodicTimer::i_period
private

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