addressed amb1201 - no_mapchange timers now get removed right after onmapend

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401727
This commit is contained in:
David Anderson 2007-11-25 02:45:12 +00:00
parent ef8db35a49
commit 54ad852d72
4 changed files with 13 additions and 19 deletions

View File

@ -29,7 +29,7 @@
* Version: $Id$ * Version: $Id$
*/ */
#if defined CRAZY_DEBUG #if defined DEBUG
#include "sm_globals.h" #include "sm_globals.h"
#include "sourcemm_api.h" #include "sourcemm_api.h"
#include "Tlhelp32.h" #include "Tlhelp32.h"

View File

@ -224,11 +224,6 @@ void TimerSystem::OnSourceModShutdown()
g_Forwards.ReleaseForward(m_pOnMapTimeLeftChanged); g_Forwards.ReleaseForward(m_pOnMapTimeLeftChanged);
} }
void TimerSystem::OnSourceModLevelChange(const char *mapName)
{
MapChange(true);
}
void TimerSystem::OnSourceModLevelEnd() void TimerSystem::OnSourceModLevelEnd()
{ {
m_bHasMapTickedYet = false; m_bHasMapTickedYet = false;
@ -423,7 +418,7 @@ void TimerSystem::KillTimer(ITimer *pTimer)
} }
CStack<ITimer *> s_tokill; CStack<ITimer *> s_tokill;
void TimerSystem::MapChange(bool real_mapchange) void TimerSystem::RemoveMapChangeTimers()
{ {
ITimer *pTimer; ITimer *pTimer;
TimerIter iter; TimerIter iter;
@ -431,7 +426,7 @@ void TimerSystem::MapChange(bool real_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);
if (real_mapchange && (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE)) if (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE)
{ {
s_tokill.push(pTimer); s_tokill.push(pTimer);
} }
@ -440,7 +435,7 @@ void TimerSystem::MapChange(bool real_mapchange)
for (iter=m_LoopTimers.begin(); iter!=m_LoopTimers.end(); iter++) for (iter=m_LoopTimers.begin(); iter!=m_LoopTimers.end(); iter++)
{ {
pTimer = (*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); s_tokill.push(pTimer);
} }

View File

@ -66,7 +66,6 @@ public:
~TimerSystem(); ~TimerSystem();
public: //SMGlobalClass public: //SMGlobalClass
void OnSourceModAllInitialized(); void OnSourceModAllInitialized();
void OnSourceModLevelChange(const char *mapName);
void OnSourceModLevelEnd(); void OnSourceModLevelEnd();
void OnSourceModGameInitialized(); void OnSourceModGameInitialized();
void OnSourceModShutdown(); void OnSourceModShutdown();
@ -81,7 +80,7 @@ public: //ITimerSystem
bool GetMapTimeLeft(float *pTime); bool GetMapTimeLeft(float *pTime);
public: public:
void RunFrame(); void RunFrame();
void MapChange(bool real_mapchange); void RemoveMapChangeTimers();
void GameFrame(bool simulating); void GameFrame(bool simulating);
IMapTimer *GetMapTimer(); IMapTimer *GetMapTimer();
private: private:

View File

@ -85,7 +85,6 @@ SourceModBase::SourceModBase()
{ {
m_IsMapLoading = false; m_IsMapLoading = false;
m_ExecPluginReload = false; m_ExecPluginReload = false;
m_ExecOnMapEnd = false;
m_GotBasePath = false; m_GotBasePath = false;
} }
@ -326,7 +325,6 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch
m_IsMapLoading = true; m_IsMapLoading = true;
m_ExecPluginReload = true; m_ExecPluginReload = true;
m_ExecOnMapEnd = true;
/* Notify! */ /* Notify! */
SMGlobalClass *pBase = SMGlobalClass::head; SMGlobalClass *pBase = SMGlobalClass::head;
@ -368,13 +366,15 @@ void SourceModBase::LevelShutdown()
next->OnSourceModLevelEnd(); next->OnSourceModLevelEnd();
next = next->m_pGlobalClassNext; next = next->m_pGlobalClassNext;
} }
g_LevelEndBarrier = false;
} if (g_pOnMapEnd != NULL)
{
g_pOnMapEnd->Execute(NULL);
}
if (g_pOnMapEnd && m_ExecOnMapEnd) g_Timers.RemoveMapChangeTimers();
{
g_pOnMapEnd->Execute(NULL); g_LevelEndBarrier = false;
m_ExecOnMapEnd = false;
} }
g_OnMapStarted = false; g_OnMapStarted = false;