mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-01-19 08:52:34 +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()
|
void CSmmAPI::LoadAsVSP()
|
||||||
{
|
{
|
||||||
g_Engine.engine->ServerCommand("plugin_load \n");
|
char path[260];
|
||||||
g_Engine.engine->ServerExecute();
|
if (!GetFileOfAddress(CreateInterface, path, sizeof(path)))
|
||||||
|
|
||||||
IServerPluginCallbacks *iface = NULL;
|
|
||||||
if (g_VspListener.IsLoaded())
|
|
||||||
{
|
{
|
||||||
iface = &g_VspListener;
|
/* Failed! */
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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()
|
void CSmmAPI::EnableVSPListener()
|
||||||
|
@ -57,7 +57,7 @@ bool bGameInit = false;
|
|||||||
SourceHook::List<GameDllInfo *> gamedll_list;
|
SourceHook::List<GameDllInfo *> gamedll_list;
|
||||||
SourceHook::CallClass<IServerGameDLL> *g_GameDllPatch;
|
SourceHook::CallClass<IServerGameDLL> *g_GameDllPatch;
|
||||||
int g_GameDllVersion = 0;
|
int g_GameDllVersion = 0;
|
||||||
const char VSPIFACE[] = "ISERVERPLUGINS";
|
const char VSPIFACE[] = "ISERVERPLUGINCALLBACKS";
|
||||||
const char GAMEINFO_PATH[] = "|gameinfo_path|";
|
const char GAMEINFO_PATH[] = "|gameinfo_path|";
|
||||||
|
|
||||||
void ClearGamedllList();
|
void ClearGamedllList();
|
||||||
@ -225,7 +225,7 @@ SMM_API void *CreateInterface(const char *iface, int *ret)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(iface, VSPIFACE, sizeof(VSPIFACE) - 1) == 0)
|
if (strncmp(iface, VSPIFACE, 22) == 0)
|
||||||
{
|
{
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vsp_listener.h"
|
#include "vsp_listener.h"
|
||||||
|
#include "CPlugin.h"
|
||||||
|
|
||||||
|
using namespace SourceMM;
|
||||||
|
|
||||||
VSPListener g_VspListener;
|
VSPListener g_VspListener;
|
||||||
|
|
||||||
@ -118,6 +121,32 @@ bool VSPListener::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gam
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Loaded = true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user