diff -r 62c6fb7c533b -r 39ae94ad60ce core/sourcemod.cpp --- a/core/sourcemod.cpp Thu Jun 07 07:36:41 2007 +0000 +++ b/core/sourcemod.cpp Thu Jun 07 18:50:52 2007 +0000 @@ -256,6 +256,7 @@ g_Loaded = true; } +static bool g_LevelEndBarrier = false; bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) { /* If we're not loaded... */ @@ -306,6 +307,8 @@ g_pOnMapEnd = g_Forwards.CreateForward("OnMapEnd", ET_Ignore, 0, NULL); } + g_LevelEndBarrier = true; + RETURN_META_VALUE(MRES_IGNORED, true); } @@ -405,6 +408,17 @@ void SourceModBase::LevelShutdown() { + if (g_LevelEndBarrier) + { + SMGlobalClass *next = SMGlobalClass::head; + while (next) + { + next->OnSourceModLevelEnd(); + next = next->m_pGlobalClassNext; + } + g_LevelEndBarrier = false; + } + if (g_pOnMapEnd && m_ExecOnMapEnd) { g_pOnMapEnd->Execute(NULL);