Merge pull request #127 from alliedmodders/coremapend

Add OnCoreMapEnd to extension's interface.
This commit is contained in:
Kyle Sanderson 2014-08-15 20:48:59 -07:00
commit 766b6e1770
5 changed files with 32 additions and 1 deletions

View File

@ -1360,6 +1360,24 @@ void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount,
}
}
void CExtensionManager::CallOnCoreMapEnd()
{
IExtensionInterface *pAPI;
List<CExtension *>::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<IExtension *> *CExtensionManager::ListExtensions()
{
CVector<IExtension *> *list = new CVector<IExtension *>();

View File

@ -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<IExtension *> *ListExtensions();
void FreeExtensionList(const CVector<IExtension *> *list);

View File

@ -211,6 +211,7 @@ public:
virtual void AddRawDependency(IExtension *myself, IdentityToken_t *token, void *iface) = 0;
virtual const CVector<IExtension *> *ListExtensions() = 0;
virtual void FreeExtensionList(const CVector<IExtension *> *list) = 0;
virtual void CallOnCoreMapEnd() = 0;
};
class AutoPluginList

View File

@ -395,6 +395,7 @@ void SourceModBase::LevelShutdown()
{
g_pOnMapEnd->Execute(NULL);
}
extsys->CallOnCoreMapEnd();
g_Timers.RemoveMapChangeTimers();

View File

@ -135,8 +135,9 @@ namespace SourceMod
*
* V6 - added TestFeature() to IShareSys.
* V7 - added OnDependenciesDropped() to IExtensionInterface.
* V8 - added OnCoreMapEnd() to IExtensionInterface.
*/
#define SMINTERFACE_EXTENSIONAPI_VERSION 7
#define SMINTERFACE_EXTENSIONAPI_VERSION 8
/**
* @brief The interface an extension must expose.
@ -325,6 +326,15 @@ namespace SourceMod
virtual void OnDependenciesDropped()
{
}
/**
* @brief Called on level shutdown
*
*/
virtual void OnCoreMapEnd()
{
}
};
/**