Global forwards created after all plugins have been loaded now properly get filled with IPluginFunction pointers.
Added CPluginManager::AddFunctionsToForward() to help do this... --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40617
This commit is contained in:
parent
3f7180aa65
commit
62aa55b23b
@ -55,6 +55,8 @@ IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned
|
||||
|
||||
if (fwd)
|
||||
{
|
||||
g_PluginSys.AddFunctionsToForward(name, fwd);
|
||||
|
||||
m_managed.push_back(fwd);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "ShareSys.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "HandleSys.h"
|
||||
#include "ForwardSys.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "sourcemod.h"
|
||||
#include "TextParsers.h"
|
||||
@ -1879,3 +1880,25 @@ bool CPluginManager::AddFakeNative(IPluginFunction *pFunction, const char *name,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPluginManager::AddFunctionsToForward(const char *name, IChangeableForward *pForward)
|
||||
{
|
||||
List<CPlugin *>::iterator iter;
|
||||
CPlugin *pPlugin;
|
||||
IPluginFunction *pFunction;
|
||||
|
||||
for (iter = m_plugins.begin(); iter != m_plugins.end(); iter++)
|
||||
{
|
||||
pPlugin = (*iter);
|
||||
|
||||
if (pPlugin->GetStatus() <= Plugin_Paused)
|
||||
{
|
||||
pFunction = pPlugin->GetBaseContext()->GetFunctionByName(name);
|
||||
|
||||
if (pFunction)
|
||||
{
|
||||
pForward->AddFunction(pFunction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <IPluginSys.h>
|
||||
#include <IHandleSys.h>
|
||||
#include <IForwardSys.h>
|
||||
#include <sh_list.h>
|
||||
#include <sh_stack.h>
|
||||
#include <sh_vector.h>
|
||||
@ -354,6 +355,12 @@ public:
|
||||
*/
|
||||
void ReloadOrUnloadPlugins();
|
||||
|
||||
/**
|
||||
* Add public functions from all running or paused
|
||||
* plugins to the specified forward if the names match.
|
||||
*/
|
||||
void AddFunctionsToForward(const char *name, IChangeableForward *pForward);
|
||||
|
||||
private:
|
||||
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t err_max);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user