From 3c3906b49497026bfd9b72863fca2671b1be122c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 2 May 2007 17:49:23 +0000 Subject: [PATCH] added request amb234 (OnMapEnd) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40724 --- core/sourcemod.cpp | 16 ++++++++++++++++ plugins/include/sourcemod.inc | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/core/sourcemod.cpp b/core/sourcemod.cpp index 79202339..aeaaa1ff 100644 --- a/core/sourcemod.cpp +++ b/core/sourcemod.cpp @@ -45,6 +45,7 @@ IdentityToken_t *g_pCoreIdent = NULL; float g_LastTime = 0.0f; float g_LastAuthCheck = 0.0f; IForward *g_pOnGameFrame = NULL; +IForward *g_pOnMapEnd = NULL; bool g_Loaded = false; typedef int (*GIVEENGINEPOINTER)(ISourcePawnEngine *); @@ -288,6 +289,11 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch g_pOnGameFrame = g_Forwards.CreateForward("OnGameFrame", ET_Ignore, 0, NULL); } + if (!g_pOnMapEnd) + { + g_pOnMapEnd = g_Forwards.CreateForward("OnMapEnd", ET_Ignore, 0, NULL); + } + RETURN_META_VALUE(MRES_IGNORED, true); } @@ -319,6 +325,11 @@ void SourceModBase::GameFrame(bool simulating) void SourceModBase::LevelShutdown() { + if (g_pOnMapEnd) + { + g_pOnMapEnd->Execute(NULL); + } + if (m_ExecPluginReload) { g_PluginSys.ReloadOrUnloadPlugins(); @@ -396,6 +407,11 @@ void SourceModBase::CloseSourceMod() { g_Forwards.ReleaseForward(g_pOnGameFrame); } + + if (g_pOnMapEnd) + { + g_Forwards.ReleaseForward(g_pOnMapEnd); + } /* Notify! */ SMGlobalClass *pBase = SMGlobalClass::head; diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc index 9e548a34..8568fd6d 100644 --- a/plugins/include/sourcemod.inc +++ b/plugins/include/sourcemod.inc @@ -121,6 +121,11 @@ forward OnGameFrame(); */ forward OnMapStart(); +/** + * Called right before a map ends. + */ +forward OnMapEnd(); + /** * Returns the calling plugin's Handle. *