3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_SOURCEMOD_CTIMERSYS_H_
16 #define _INCLUDE_SOURCEMOD_CTIMERSYS_H_
19 #include <ITimerSystem.h>
22 #include "sourcemm_api.h"
24 using namespace SourceHook;
25 using namespace SourceMod;
27 typedef List<ITimer *> TimerList;
28 typedef List<ITimer *>::iterator TimerIter;
32 bool ticking; /* true=game is ticking, false=we're ticking */
33 unsigned int tickcount; /* number of simulated ticks we've done */
34 float ticktime; /* tick time we're maintaining */
37 class SourceMod::ITimer
40 void Initialize(ITimedEvent *pCallbacks, float fInterval, float fToExec, void *pData, int flags);
41 ITimedEvent *m_Listener;
56 public: //SMGlobalClass
57 void OnSourceModAllInitialized();
58 void OnSourceModLevelChange(const char *mapName);
59 public: //ITimerSystem
60 ITimer *CreateTimer(ITimedEvent *pCallbacks, float fInterval, void *pData, int flags);
61 void KillTimer(ITimer *pTimer);
62 void FireTimerOnce(ITimer *pTimer, bool delayExec=false);
67 List<ITimer *> m_SingleTimers;
68 List<ITimer *> m_LoopTimers;
69 CStack<ITimer *> m_FreeTimers;
73 extern TimerSystem g_Timers;
74 extern TickInfo g_SimTicks;
76 #endif //_INCLUDE_SOURCEMOD_CTIMERSYS_H_