From 7a88386568bc813abc0d10f0a2433b8580cea33b Mon Sep 17 00:00:00 2001 From: Ruben Gonzalez Date: Fri, 8 Aug 2014 01:01:47 -0400 Subject: [PATCH 1/2] Add OnCoreMapEnd to extension's interface. --- core/logic/ExtensionSys.cpp | 18 ++++++++++++++++++ core/logic/ExtensionSys.h | 1 + core/logic/intercom.h | 1 + core/sourcemod.cpp | 1 + public/IExtensionSys.h | 11 ++++++++++- 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/core/logic/ExtensionSys.cpp b/core/logic/ExtensionSys.cpp index 87f3c5e6..cb7b5f0e 100644 --- a/core/logic/ExtensionSys.cpp +++ b/core/logic/ExtensionSys.cpp @@ -1360,6 +1360,24 @@ void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount, } } +void CExtensionManager::CallOnCoreMapEnd() +{ + IExtensionInterface *pAPI; + List::iterator iter; + + for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++) + { + if ((pAPI = (*iter)->GetAPI()) == NULL) + { + continue; + } + if (pAPI->GetExtensionVersion() > 7) + { + pAPI->OnCoreMapEnd(); + } + } +} + const CVector *CExtensionManager::ListExtensions() { CVector *list = new CVector(); diff --git a/core/logic/ExtensionSys.h b/core/logic/ExtensionSys.h index 76dab140..33a40dcd 100644 --- a/core/logic/ExtensionSys.h +++ b/core/logic/ExtensionSys.h @@ -173,6 +173,7 @@ public: void AddLibrary(IExtension *pSource, const char *library); bool LibraryExists(const char *library); void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax); + void CallOnCoreMapEnd(); void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface); const CVector *ListExtensions(); void FreeExtensionList(const CVector *list); diff --git a/core/logic/intercom.h b/core/logic/intercom.h index 5d86853d..b28c5a91 100644 --- a/core/logic/intercom.h +++ b/core/logic/intercom.h @@ -211,6 +211,7 @@ public: virtual void AddRawDependency(IExtension *myself, IdentityToken_t *token, void *iface) = 0; virtual const CVector *ListExtensions() = 0; virtual void FreeExtensionList(const CVector *list) = 0; + virtual void CallOnCoreMapEnd() = 0; }; class AutoPluginList diff --git a/core/sourcemod.cpp b/core/sourcemod.cpp index f31b7af6..32fa99ff 100644 --- a/core/sourcemod.cpp +++ b/core/sourcemod.cpp @@ -395,6 +395,7 @@ void SourceModBase::LevelShutdown() { g_pOnMapEnd->Execute(NULL); } + extsys->CallOnCoreMapEnd(); g_Timers.RemoveMapChangeTimers(); diff --git a/public/IExtensionSys.h b/public/IExtensionSys.h index 3c63e7e3..34e45a2b 100644 --- a/public/IExtensionSys.h +++ b/public/IExtensionSys.h @@ -136,7 +136,7 @@ namespace SourceMod * V6 - added TestFeature() to IShareSys. * V7 - added OnDependenciesDropped() to IExtensionInterface. */ - #define SMINTERFACE_EXTENSIONAPI_VERSION 7 + #define SMINTERFACE_EXTENSIONAPI_VERSION 8 /** * @brief The interface an extension must expose. @@ -325,6 +325,15 @@ namespace SourceMod virtual void OnDependenciesDropped() { } + + /** + * @brief Called on level shutdown + * + */ + + virtual void OnCoreMapEnd() + { + } }; /** From 2ba0b794eaa612524c08626682bb2fe990159a42 Mon Sep 17 00:00:00 2001 From: Ruben Gonzalez Date: Fri, 8 Aug 2014 10:57:38 -0400 Subject: [PATCH 2/2] Added note to know what version OnCoreMapEnd was added to. --- public/IExtensionSys.h | 1 + 1 file changed, 1 insertion(+) diff --git a/public/IExtensionSys.h b/public/IExtensionSys.h index 34e45a2b..8e008b0e 100644 --- a/public/IExtensionSys.h +++ b/public/IExtensionSys.h @@ -135,6 +135,7 @@ namespace SourceMod * * V6 - added TestFeature() to IShareSys. * V7 - added OnDependenciesDropped() to IExtensionInterface. + * V8 - added OnCoreMapEnd() to IExtensionInterface. */ #define SMINTERFACE_EXTENSIONAPI_VERSION 8