mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 14:37:29 +08:00
[bot] Implement/match CScriptTimers::DeleteForMode(...)
This commit is contained in:
parent
02b4a7b509
commit
c1d02b9ab0
@ -34,6 +34,29 @@ void CScriptTimers::FreeMem(ScriptTimer_s* Timer)
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Kills only the timers found in one mode
|
||||
|
||||
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)
|
||||
{
|
||||
m_dwTimerCount++;
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
CScriptTimers();
|
||||
~CScriptTimers();
|
||||
|
||||
void DeleteForMode(AMX* pEndedAMX);
|
||||
DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX);
|
||||
void Kill(DWORD dwTimerId);
|
||||
void FreeMem(ScriptTimer_s* Timer);
|
||||
|
Loading…
Reference in New Issue
Block a user