added amb567, new OnAllPluginsLoaded forward

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401227
This commit is contained in:
Borja Ferrer 2007-07-31 22:34:52 +00:00
parent b0e107bdfb
commit b0a96e69c1
4 changed files with 48 additions and 0 deletions

View File

@ -510,6 +510,9 @@ void SourceModBase::DoGlobalPluginLoads()
/* Re-mark any extensions as loaded */ /* Re-mark any extensions as loaded */
g_Extensions.MarkAllLoaded(); g_Extensions.MarkAllLoaded();
/* Call OnAllPluginsLoaded */
g_PluginSys.AllPluginsLoaded();
} }
size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...) size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...)

View File

@ -340,6 +340,23 @@ void CPlugin::Call_OnPluginEnd()
pFunction->Execute(&result); pFunction->Execute(&result);
} }
void CPlugin::Call_OnAllPluginsLoaded()
{
if (m_status > Plugin_Paused)
{
return;
}
cell_t result;
IPluginFunction *pFunction = m_ctx.base->GetFunctionByName("OnAllPluginsLoaded");
if (!pFunction)
{
return;
}
pFunction->Execute(&result);
}
bool CPlugin::Call_AskPluginLoad(char *error, size_t maxlength) bool CPlugin::Call_AskPluginLoad(char *error, size_t maxlength)
{ {
if (m_status != Plugin_Created) if (m_status != Plugin_Created)
@ -977,6 +994,7 @@ IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType typ
UnloadPlugin(pl); UnloadPlugin(pl);
return NULL; return NULL;
} }
pl->Call_OnAllPluginsLoaded();
} }
return pl; return pl;
@ -2315,3 +2333,15 @@ bool CPluginManager::LibraryExists(const char *lib)
return false; return false;
} }
void CPluginManager::AllPluginsLoaded()
{
List<CPlugin *>::iterator iter;
CPlugin *pl;
for (iter=m_plugins.begin(); iter!=m_plugins.end(); iter++)
{
pl = (*iter);
pl->Call_OnAllPluginsLoaded();
}
}

View File

@ -201,6 +201,11 @@ public:
*/ */
void Call_OnPluginEnd(); void Call_OnPluginEnd();
/**
* Calls the OnAllPluginsLoaded function.
*/
void Call_OnAllPluginsLoaded();
/** /**
* Toggles debug mode in the plugin * Toggles debug mode in the plugin
*/ */
@ -395,6 +400,11 @@ public:
*/ */
void AddFunctionsToForward(const char *name, IChangeableForward *pForward); void AddFunctionsToForward(const char *name, IChangeableForward *pForward);
/**
* Iterates through plugins to call OnAllPluginsLoaded.
*/
void AllPluginsLoaded();
CPlugin *GetPluginFromIdentity(IdentityToken_t *pToken); CPlugin *GetPluginFromIdentity(IdentityToken_t *pToken);
void Shutdown(); void Shutdown();

View File

@ -143,6 +143,11 @@ forward OnConfigsExecuted();
*/ */
forward OnServerCfg(); forward OnServerCfg();
/**
* Called after all plugins have been loaded.
*/
forward OnAllPluginsLoaded();
/** /**
* Returns the calling plugin's Handle. * Returns the calling plugin's Handle.
* *