core/sourcemod.cpp
changeset 916 39ae94ad60ce
parent 893 a3bc816549a8
child 938 8e95112b2501
     1.1 --- a/core/sourcemod.cpp	Thu Jun 07 07:36:41 2007 +0000
     1.2 +++ b/core/sourcemod.cpp	Thu Jun 07 18:50:52 2007 +0000
     1.3 @@ -256,6 +256,7 @@
     1.4  	g_Loaded = true;
     1.5  }
     1.6  
     1.7 +static bool g_LevelEndBarrier = false;
     1.8  bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
     1.9  {
    1.10  	/* If we're not loaded... */
    1.11 @@ -306,6 +307,8 @@
    1.12  		g_pOnMapEnd = g_Forwards.CreateForward("OnMapEnd", ET_Ignore, 0, NULL);
    1.13  	}
    1.14  
    1.15 +	g_LevelEndBarrier = true;
    1.16 +
    1.17  	RETURN_META_VALUE(MRES_IGNORED, true);
    1.18  }
    1.19  
    1.20 @@ -405,6 +408,17 @@
    1.21  
    1.22  void SourceModBase::LevelShutdown()
    1.23  {
    1.24 +	if (g_LevelEndBarrier)
    1.25 +	{
    1.26 +		SMGlobalClass *next = SMGlobalClass::head;
    1.27 +		while (next)
    1.28 +		{
    1.29 +			next->OnSourceModLevelEnd();
    1.30 +			next = next->m_pGlobalClassNext;
    1.31 +		}
    1.32 +		g_LevelEndBarrier = false;
    1.33 +	}
    1.34 +
    1.35  	if (g_pOnMapEnd && m_ExecOnMapEnd)
    1.36  	{
    1.37  		g_pOnMapEnd->Execute(NULL);