1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-31 20:52:18 +01:00

fixed compatibility with future engine versions

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40694
This commit is contained in:
David Anderson 2008-07-04 02:34:45 +00:00
parent dd44e98082
commit 417c4f1e56
4 changed files with 22 additions and 7 deletions

View File

@ -383,8 +383,13 @@ ConVar *BaseProvider::CreateConVar(const char *name,
return pVar; return pVar;
} }
IServerPluginCallbacks *BaseProvider::GetVSPCallbacks(const char *iface) IServerPluginCallbacks *BaseProvider::GetVSPCallbacks(int version)
{ {
if (version > 2)
{
return NULL;
}
g_VspListener.SetLoadable(true); g_VspListener.SetLoadable(true);
return &g_VspListener; return &g_VspListener;
} }

View File

@ -56,7 +56,7 @@ public:
virtual void ConsolePrint(const char *msg); virtual void ConsolePrint(const char *msg);
virtual bool IsRemotePrintingAvailable(); virtual bool IsRemotePrintingAvailable();
virtual void ClientConsolePrint(edict_t *client, const char *msg); virtual void ClientConsolePrint(edict_t *client, const char *msg);
virtual IServerPluginCallbacks *GetVSPCallbacks(const char *iface); virtual IServerPluginCallbacks *GetVSPCallbacks(int version);
virtual void DisplayError(const char *fmt, ...); virtual void DisplayError(const char *fmt, ...);
virtual void DisplayWarning(const char *fmt, ...); virtual void DisplayWarning(const char *fmt, ...);
virtual int TryServerGameDLL(const char *iface); virtual int TryServerGameDLL(const char *iface);

View File

@ -227,18 +227,28 @@ SMM_API void *CreateInterface(const char *iface, int *ret)
if (strncmp(iface, "ISERVERPLUGINCALLBACKS", 22) == 0) if (strncmp(iface, "ISERVERPLUGINCALLBACKS", 22) == 0)
{ {
vsp_callbacks = provider->GetVSPCallbacks(iface); if (vsp_callbacks != NULL && atoi(&iface[22]) != vsp_version)
if (vsp_callbacks != NULL && vsp_version == 0)
{ {
vsp_version = atoi(&iface[22]); if (ret != NULL)
{
*ret = IFACE_FAILED;
}
return NULL;
} }
vsp_version = atoi(&iface[22]);
vsp_callbacks = provider->GetVSPCallbacks(vsp_version);
if (ret) if (ret)
{ {
*ret = (vsp_callbacks != NULL) ? IFACE_OK : IFACE_FAILED; *ret = (vsp_callbacks != NULL) ? IFACE_OK : IFACE_FAILED;
} }
if (vsp_callbacks == NULL)
{
vsp_version = 0;
}
return vsp_callbacks; return vsp_callbacks;
} }

View File

@ -151,7 +151,7 @@ namespace SourceMM
* @param iface Interface version * @param iface Interface version
* @return IServerPluginCallbacks pointer. * @return IServerPluginCallbacks pointer.
*/ */
virtual IServerPluginCallbacks *GetVSPCallbacks(const char *iface) =0; virtual IServerPluginCallbacks *GetVSPCallbacks(int version) =0;
/** /**
* @brief Halts the server with a fatal error message. * @brief Halts the server with a fatal error message.