Fixed SDKHooks looking for IServerTools on < Orangebox, causing load failure (bug 5603).

This commit is contained in:
Nicholas Hastings 2013-02-08 22:46:49 -05:00
parent 0ac7867b3d
commit 74aafaa72f
2 changed files with 8 additions and 1 deletions

View File

@ -291,7 +291,10 @@ ISmmAPI *g_SMAPI = NULL; /**< SourceMM API pointer */
IVEngineServer *engine = NULL; /**< IVEngineServer pointer */ IVEngineServer *engine = NULL; /**< IVEngineServer pointer */
IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
#if SOURCE_ENGINE >= SE_ORANGEBOX
IServerTools *servertools = NULL; /**< IServerTools pointer */ IServerTools *servertools = NULL; /**< IServerTools pointer */
#endif
/** Exposes the extension to Metamod */ /** Exposes the extension to Metamod */
SMM_API void *PL_EXPOSURE(const char *name, int *code) SMM_API void *PL_EXPOSURE(const char *name, int *code)
@ -324,10 +327,12 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
#if !defined METAMOD_PLAPI_VERSION #if !defined METAMOD_PLAPI_VERSION
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
GET_V_IFACE_CURRENT(serverFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION);
#else #else
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
#endif
#if SOURCE_ENGINE >= SE_ORANGEBOX
GET_V_IFACE_CURRENT(GetServerFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION); GET_V_IFACE_CURRENT(GetServerFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION);
#endif #endif

View File

@ -301,8 +301,10 @@ extern INativeInterface *ninvoke;
PLUGIN_GLOBALVARS(); PLUGIN_GLOBALVARS();
extern IVEngineServer *engine; extern IVEngineServer *engine;
extern IServerGameDLL *gamedll; extern IServerGameDLL *gamedll;
#if SOURCE_ENGINE >= SE_ORANGEBOX
extern IServerTools *servertools; extern IServerTools *servertools;
#endif #endif
#endif
/** Creates a SourceMod interface macro pair */ /** Creates a SourceMod interface macro pair */
#define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION