added amb622, TIMER_FLAG_NO_MAPCHANGE
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401114
This commit is contained in:
parent
91a1e2faaa
commit
c33c27391f
@ -207,6 +207,7 @@ void TimerSystem::KillTimer(ITimer *pTimer)
|
|||||||
m_FreeTimers.push(pTimer);
|
m_FreeTimers.push(pTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CStack<ITimer *> s_tokill;
|
||||||
void TimerSystem::MapChange()
|
void TimerSystem::MapChange()
|
||||||
{
|
{
|
||||||
ITimer *pTimer;
|
ITimer *pTimer;
|
||||||
@ -215,13 +216,29 @@ void TimerSystem::MapChange()
|
|||||||
for (iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); iter++)
|
for (iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); iter++)
|
||||||
{
|
{
|
||||||
pTimer = (*iter);
|
pTimer = (*iter);
|
||||||
pTimer->m_ToExec = pTimer->m_ToExec - m_LastExecTime + GetSimulatedTime();
|
if (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE)
|
||||||
|
{
|
||||||
|
s_tokill.push(pTimer);
|
||||||
|
} else {
|
||||||
|
pTimer->m_ToExec = pTimer->m_ToExec - m_LastExecTime + GetSimulatedTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iter=m_LoopTimers.begin(); iter!=m_LoopTimers.end(); iter++)
|
for (iter=m_LoopTimers.begin(); iter!=m_LoopTimers.end(); iter++)
|
||||||
{
|
{
|
||||||
pTimer = (*iter);
|
pTimer = (*iter);
|
||||||
pTimer->m_ToExec = pTimer->m_ToExec - m_LastExecTime + GetSimulatedTime();
|
if (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE)
|
||||||
|
{
|
||||||
|
s_tokill.push(pTimer);
|
||||||
|
} else {
|
||||||
|
pTimer->m_ToExec = pTimer->m_ToExec - m_LastExecTime + GetSimulatedTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!s_tokill.empty())
|
||||||
|
{
|
||||||
|
KillTimer(s_tokill.front());
|
||||||
|
s_tokill.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LastExecTime = GetSimulatedTime();
|
m_LastExecTime = GetSimulatedTime();
|
||||||
|
@ -20,8 +20,9 @@
|
|||||||
|
|
||||||
#include <datapack>
|
#include <datapack>
|
||||||
|
|
||||||
#define TIMER_REPEAT (1<<0) /**< Timer will repeat until it returns Plugin_Stop */
|
#define TIMER_REPEAT (1<<0) /**< Timer will repeat until it returns Plugin_Stop */
|
||||||
#define TIMER_HNDL_CLOSE (1<<9) /**< Timer will automatically call CloseHandle() on its value when finished */
|
#define TIMER_FLAG_NO_MAPCHANGE (1<<1) /**< Timer will not carry over mapchanges */
|
||||||
|
#define TIMER_HNDL_CLOSE (1<<9) /**< Timer will automatically call CloseHandle() on its value when finished */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any of the following prototypes will work for a timed function.
|
* Any of the following prototypes will work for a timed function.
|
||||||
|
@ -59,7 +59,8 @@ namespace SourceMod
|
|||||||
virtual void OnTimerEnd(ITimer *pTimer, void *pData) =0;
|
virtual void OnTimerEnd(ITimer *pTimer, void *pData) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TIMER_FLAG_REPEAT (1<<0)
|
#define TIMER_FLAG_REPEAT (1<<0) /**< Timer will repeat until stopped */
|
||||||
|
#define TIMER_FLAG_NO_MAPCHANGE (1<<1) /**< Timer will not carry over mapchanges */
|
||||||
|
|
||||||
class ITimerSystem : public SMInterface
|
class ITimerSystem : public SMInterface
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user