From 4c3bfe503f65af145421173fd6161fa13372ffab Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:24:28 +0800 Subject: [PATCH] [bot] Implement/match `CScriptTimers::Delete(...)` --- bot/scrtimers.cpp | 14 ++++++++++++++ bot/scrtimers.h | 1 + 2 files changed, 15 insertions(+) diff --git a/bot/scrtimers.cpp b/bot/scrtimers.cpp index 21b6e39..9184627 100644 --- a/bot/scrtimers.cpp +++ b/bot/scrtimers.cpp @@ -78,6 +78,20 @@ DWORD CScriptTimers::New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX //---------------------------------------------------------------------------------- +void CScriptTimers::Delete(DWORD dwTimerId) +{ + DwordTimerMap::iterator itor; + itor = m_Timers.find(dwTimerId); + if (itor != m_Timers.end()) + { + FreeMem(itor->second); + SAFE_DELETE(itor->second); + m_Timers.erase(itor); + } +} + +//---------------------------------------------------------------------------------- + void CScriptTimers::Kill(DWORD dwTimerId) { DwordTimerMap::iterator itor; diff --git a/bot/scrtimers.h b/bot/scrtimers.h index c1ad00f..efb1565 100644 --- a/bot/scrtimers.h +++ b/bot/scrtimers.h @@ -29,6 +29,7 @@ public: void DeleteForMode(AMX* pEndedAMX); DWORD New(char* szScriptFunc, int iInterval, BOOL bRepeating, AMX* pAMX); + void Delete(DWORD dwTimerId); void Kill(DWORD dwTimerId); void FreeMem(ScriptTimer_s* Timer); };