mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-01-18 07:52:32 +01:00
fixed a post-release error where the vsp listener API simply didn't work :(
--HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40368
This commit is contained in:
parent
eca25f0b14
commit
9c562a9e62
@ -454,39 +454,15 @@ void CSmmAPI::ClientConPrintf(edict_t *client, const char *fmt, ...)
|
||||
|
||||
void CSmmAPI::LoadAsVSP()
|
||||
{
|
||||
g_Engine.engine->ServerCommand("plugin_load \n");
|
||||
g_Engine.engine->ServerExecute();
|
||||
|
||||
IServerPluginCallbacks *iface = NULL;
|
||||
if (g_VspListener.IsLoaded())
|
||||
char path[260];
|
||||
if (!GetFileOfAddress(CreateInterface, path, sizeof(path)))
|
||||
{
|
||||
iface = &g_VspListener;
|
||||
}
|
||||
|
||||
PluginIter iter;
|
||||
CPluginManager::CPlugin *pPlugin;
|
||||
SourceHook::List<IMetamodListener *>::iterator event;
|
||||
IMetamodListener *pML;
|
||||
for (iter=g_PluginMngr._begin(); iter!=g_PluginMngr._end(); iter++)
|
||||
{
|
||||
pPlugin = (*iter);
|
||||
if (pPlugin->m_Status < Pl_Paused)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* Only valid for plugins >= 10 (v1:5, SourceMM 1.4) */
|
||||
if (pPlugin->m_API->GetApiVersion() < 10)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (event=pPlugin->m_Events.begin();
|
||||
event!=pPlugin->m_Events.end();
|
||||
event++)
|
||||
{
|
||||
pML = (*event);
|
||||
pML->OnVSPListening(iface);
|
||||
}
|
||||
/* Failed! */
|
||||
}
|
||||
char command[350];
|
||||
g_VspListener.SetLoadable(true);
|
||||
UTIL_Format(command, sizeof(command), "plugin_load \"%s\"\n", path);
|
||||
g_Engine.engine->ServerCommand(command);
|
||||
}
|
||||
|
||||
void CSmmAPI::EnableVSPListener()
|
||||
|
@ -57,7 +57,7 @@ bool bGameInit = false;
|
||||
SourceHook::List<GameDllInfo *> gamedll_list;
|
||||
SourceHook::CallClass<IServerGameDLL> *g_GameDllPatch;
|
||||
int g_GameDllVersion = 0;
|
||||
const char VSPIFACE[] = "ISERVERPLUGINS";
|
||||
const char VSPIFACE[] = "ISERVERPLUGINCALLBACKS";
|
||||
const char GAMEINFO_PATH[] = "|gameinfo_path|";
|
||||
|
||||
void ClearGamedllList();
|
||||
@ -225,7 +225,7 @@ SMM_API void *CreateInterface(const char *iface, int *ret)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strncmp(iface, VSPIFACE, sizeof(VSPIFACE) - 1) == 0)
|
||||
if (strncmp(iface, VSPIFACE, 22) == 0)
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
@ -9,6 +9,9 @@
|
||||
*/
|
||||
|
||||
#include "vsp_listener.h"
|
||||
#include "CPlugin.h"
|
||||
|
||||
using namespace SourceMM;
|
||||
|
||||
VSPListener g_VspListener;
|
||||
|
||||
@ -118,6 +121,32 @@ bool VSPListener::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gam
|
||||
}
|
||||
|
||||
m_Loaded = true;
|
||||
SetLoadable(false);
|
||||
|
||||
PluginIter iter;
|
||||
CPluginManager::CPlugin *pPlugin;
|
||||
SourceHook::List<IMetamodListener *>::iterator event;
|
||||
IMetamodListener *pML;
|
||||
for (iter=g_PluginMngr._begin(); iter!=g_PluginMngr._end(); iter++)
|
||||
{
|
||||
pPlugin = (*iter);
|
||||
if (pPlugin->m_Status < Pl_Paused)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* Only valid for plugins >= 10 (v1:5, SourceMM 1.4) */
|
||||
if (pPlugin->m_API->GetApiVersion() < 10)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (event=pPlugin->m_Events.begin();
|
||||
event!=pPlugin->m_Events.end();
|
||||
event++)
|
||||
{
|
||||
pML = (*event);
|
||||
pML->OnVSPListening(this);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user