mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-03 16:13:34 +08:00
[server] Implement/match CScriptTimers::DeleteForMode(...)
This commit is contained in:
parent
5675f1555b
commit
52ee926fdd
@ -34,6 +34,27 @@ void CScriptTimers::FreeMem(ScriptTimer_s* Timer)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void CScriptTimers::DeleteForMode(AMX* pEndedAMX)
|
||||||
|
{
|
||||||
|
bool bRestart = false;
|
||||||
|
DwordTimerMap::iterator itor;
|
||||||
|
for (itor = m_Timers.begin(); itor != m_Timers.end(); bRestart?(itor=m_Timers.begin()):(itor++))
|
||||||
|
{
|
||||||
|
bRestart = false;
|
||||||
|
if (itor->second->pAMX == pEndedAMX)
|
||||||
|
{
|
||||||
|
FreeMem(itor->second);
|
||||||
|
SAFE_DELETE(itor->second);
|
||||||
|
m_Timers.erase(itor);
|
||||||
|
|
||||||
|
// Can't continue iteration if a node is deleted, start iteration from start again.
|
||||||
|
bRestart = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
DWORD CScriptTimers::New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX)
|
DWORD CScriptTimers::New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX)
|
||||||
{
|
{
|
||||||
m_dwTimerCount++;
|
m_dwTimerCount++;
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
CScriptTimers();
|
CScriptTimers();
|
||||||
~CScriptTimers();
|
~CScriptTimers();
|
||||||
|
|
||||||
|
void DeleteForMode(AMX* pEndedAMX);
|
||||||
DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX);
|
DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX);
|
||||||
DWORD NewEx(char* szScriptFunc, int iInterval, BOOL bRepeating, cell *params, AMX* pAMX);
|
DWORD NewEx(char* szScriptFunc, int iInterval, BOOL bRepeating, cell *params, AMX* pAMX);
|
||||||
void Kill(DWORD dwTimerId);
|
void Kill(DWORD dwTimerId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user