Add OnNotifyPluginUnloaded forward

This commit is contained in:
Vladimir 2021-05-24 23:04:22 +03:00 committed by David Anderson
parent ff43e60831
commit 62142197c1
3 changed files with 13 additions and 0 deletions

View File

@ -1505,6 +1505,9 @@ void CPluginManager::Purge(CPlugin *plugin)
(*iter)->OnPluginUnloaded(plugin);
}
m_pOnNotifyPluginUnloaded->PushCell(plugin->GetMyHandle());
m_pOnNotifyPluginUnloaded->Execute(NULL);
plugin->DropEverything();
for (ListenerIter iter(m_listeners); !iter.done(); iter.next())
@ -1587,6 +1590,7 @@ void CPluginManager::OnSourceModAllInitialized()
m_pOnLibraryAdded = forwardsys->CreateForward("OnLibraryAdded", ET_Ignore, 1, NULL, Param_String);
m_pOnLibraryRemoved = forwardsys->CreateForward("OnLibraryRemoved", ET_Ignore, 1, NULL, Param_String);
m_pOnNotifyPluginUnloaded = forwardsys->CreateForward("OnNotifyPluginUnloaded", ET_Ignore, 1, NULL, Param_Cell);
}
void CPluginManager::OnSourceModShutdown()
@ -1601,6 +1605,7 @@ void CPluginManager::OnSourceModShutdown()
forwardsys->ReleaseForward(m_pOnLibraryAdded);
forwardsys->ReleaseForward(m_pOnLibraryRemoved);
forwardsys->ReleaseForward(m_pOnNotifyPluginUnloaded);
}
ConfigResult CPluginManager::OnSourceModConfigChanged(const char *key,

View File

@ -523,6 +523,7 @@ private:
// Forwards
IForward *m_pOnLibraryAdded;
IForward *m_pOnLibraryRemoved;
IForward *m_pOnNotifyPluginUnloaded;
};
extern CPluginManager g_PluginSys;

View File

@ -496,6 +496,13 @@ forward void OnLibraryAdded(const char[] name);
*/
forward void OnLibraryRemoved(const char[] name);
/**
* Called when a plugin unloaded.
*
* @param plugin Plugin Handle who unloaded.
*/
forward void OnNotifyPluginUnloaded(Handle plugin);
#define MAPLIST_FLAG_MAPSFOLDER (1<<0) /**< On failure, use all maps in the maps folder. */
#define MAPLIST_FLAG_CLEARARRAY (1<<1) /**< If an input array is specified, clear it before adding. */
#define MAPLIST_FLAG_NO_DEFAULT (1<<2) /**< Do not read "default" or "mapcyclefile" on failure. */