diff options
author | n0n4m3 <none@none> | 2009-12-19 10:12:40 +0100 |
---|---|---|
committer | n0n4m3 <none@none> | 2009-12-19 10:12:40 +0100 |
commit | 243f33b5eae4e5dc96e8134c650ea74daa07ee35 (patch) | |
tree | 39d943868b1bbe0116000f748bd72b7b76087683 /src/shared | |
parent | 7a3e524df2c57cb8625f08f3b8bef5befe641142 (diff) |
Implement new visibility system, based on Silverice patch for mangos
--HG--
branch : trunk
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/Timer.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/shared/Timer.h b/src/shared/Timer.h index 82f5be161d9..46bba5475bc 100644 --- a/src/shared/Timer.h +++ b/src/shared/Timer.h @@ -95,5 +95,28 @@ struct TimeTrackerSmall int32 i_expiryTime; }; +struct PeriodicTimer +{ + PeriodicTimer(int32 period, int32 start_time) : + i_expireTime(start_time), i_period(period) {} + + bool Update(const uint32 &diff) + { + if((i_expireTime -= diff) > 0) + return false; + + i_expireTime += i_period > diff ? i_period : diff; + return true; + } + + void SetPeriodic(int32 period, int32 start_time) + { + i_expireTime=start_time, i_period=period; + } + + int32 i_period; + int32 i_expireTime; +}; + #endif |