From 54ad852d723f05820c9bac90bc23f4f357e57792 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 25 Nov 2007 02:45:12 +0000 Subject: [PATCH] addressed amb1201 - no_mapchange timers now get removed right after onmapend --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401727 --- core/CrazyDebugger.cpp | 2 +- core/TimerSys.cpp | 11 +++-------- core/TimerSys.h | 3 +-- core/sourcemod.cpp | 16 ++++++++-------- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/core/CrazyDebugger.cpp b/core/CrazyDebugger.cpp index 287e87d7..7960191d 100644 --- a/core/CrazyDebugger.cpp +++ b/core/CrazyDebugger.cpp @@ -29,7 +29,7 @@ * Version: $Id$ */ -#if defined CRAZY_DEBUG +#if defined DEBUG #include "sm_globals.h" #include "sourcemm_api.h" #include "Tlhelp32.h" diff --git a/core/TimerSys.cpp b/core/TimerSys.cpp index a86945ae..464d4373 100644 --- a/core/TimerSys.cpp +++ b/core/TimerSys.cpp @@ -224,11 +224,6 @@ void TimerSystem::OnSourceModShutdown() g_Forwards.ReleaseForward(m_pOnMapTimeLeftChanged); } -void TimerSystem::OnSourceModLevelChange(const char *mapName) -{ - MapChange(true); -} - void TimerSystem::OnSourceModLevelEnd() { m_bHasMapTickedYet = false; @@ -423,7 +418,7 @@ void TimerSystem::KillTimer(ITimer *pTimer) } CStack s_tokill; -void TimerSystem::MapChange(bool real_mapchange) +void TimerSystem::RemoveMapChangeTimers() { ITimer *pTimer; TimerIter iter; @@ -431,7 +426,7 @@ void TimerSystem::MapChange(bool real_mapchange) for (iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); iter++) { pTimer = (*iter); - if (real_mapchange && (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE)) + if (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE) { s_tokill.push(pTimer); } @@ -440,7 +435,7 @@ void TimerSystem::MapChange(bool real_mapchange) for (iter=m_LoopTimers.begin(); iter!=m_LoopTimers.end(); iter++) { pTimer = (*iter); - if (real_mapchange && (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE)) + if (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE) { s_tokill.push(pTimer); } diff --git a/core/TimerSys.h b/core/TimerSys.h index 3cf0b066..3f040ea3 100644 --- a/core/TimerSys.h +++ b/core/TimerSys.h @@ -66,7 +66,6 @@ public: ~TimerSystem(); public: //SMGlobalClass void OnSourceModAllInitialized(); - void OnSourceModLevelChange(const char *mapName); void OnSourceModLevelEnd(); void OnSourceModGameInitialized(); void OnSourceModShutdown(); @@ -81,7 +80,7 @@ public: //ITimerSystem bool GetMapTimeLeft(float *pTime); public: void RunFrame(); - void MapChange(bool real_mapchange); + void RemoveMapChangeTimers(); void GameFrame(bool simulating); IMapTimer *GetMapTimer(); private: diff --git a/core/sourcemod.cpp b/core/sourcemod.cpp index e94ed402..3a30de54 100644 --- a/core/sourcemod.cpp +++ b/core/sourcemod.cpp @@ -85,7 +85,6 @@ SourceModBase::SourceModBase() { m_IsMapLoading = false; m_ExecPluginReload = false; - m_ExecOnMapEnd = false; m_GotBasePath = false; } @@ -326,7 +325,6 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch m_IsMapLoading = true; m_ExecPluginReload = true; - m_ExecOnMapEnd = true; /* Notify! */ SMGlobalClass *pBase = SMGlobalClass::head; @@ -368,13 +366,15 @@ void SourceModBase::LevelShutdown() next->OnSourceModLevelEnd(); next = next->m_pGlobalClassNext; } - g_LevelEndBarrier = false; - } + + if (g_pOnMapEnd != NULL) + { + g_pOnMapEnd->Execute(NULL); + } - if (g_pOnMapEnd && m_ExecOnMapEnd) - { - g_pOnMapEnd->Execute(NULL); - m_ExecOnMapEnd = false; + g_Timers.RemoveMapChangeTimers(); + + g_LevelEndBarrier = false; } g_OnMapStarted = false;