1.1 --- a/core/sourcemm_api.cpp Thu Feb 15 01:02:34 2007 +0000
1.2 +++ b/core/sourcemm_api.cpp Thu Feb 15 20:35:17 2007 +0000
1.3 @@ -24,6 +24,7 @@
1.4 CGlobalVars *gpGlobals = NULL;
1.5 ICvar *icvar = NULL;
1.6 IGameEventManager2 *gameevents = NULL;
1.7 +CallClass<IVEngineServer> *enginePatch = NULL;
1.8
1.9 PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);
1.10
2.1 --- a/core/sourcemm_api.h Thu Feb 15 01:02:34 2007 +0000
2.2 +++ b/core/sourcemm_api.h Thu Feb 15 20:35:17 2007 +0000
2.3 @@ -51,6 +51,9 @@
2.4 extern ISmmPluginManager *g_pMMPlugins;
2.5 extern CGlobalVars *gpGlobals;
2.6 extern IGameEventManager2 *gameevents;
2.7 +extern SourceHook::CallClass<IVEngineServer> *enginePatch;
2.8 +
2.9 +#define ENGINE_CALL(func) SH_CALL(enginePatch, &IVEngineServer::func)
2.10
2.11 PLUGIN_GLOBALVARS();
2.12
3.1 --- a/core/sourcemod.cpp Thu Feb 15 01:02:34 2007 +0000
3.2 +++ b/core/sourcemod.cpp Thu Feb 15 20:35:17 2007 +0000
3.3 @@ -156,6 +156,8 @@
3.4 SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
3.5 SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);
3.6
3.7 + enginePatch = SH_GET_CALLCLASS(engine);
3.8 +
3.9 /* Notify! */
3.10 SMGlobalClass *pBase = SMGlobalClass::head;
3.11 while (pBase)
3.12 @@ -314,6 +316,12 @@
3.13 pBase = pBase->m_pGlobalClassNext;
3.14 }
3.15
3.16 + if (enginePatch)
3.17 + {
3.18 + SH_RELEASE_CALLCLASS(enginePatch);
3.19 + enginePatch = NULL;
3.20 + }
3.21 +
3.22 SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
3.23 SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
3.24 SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);