added engine callclass

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40502
This commit is contained in:
David Anderson 2007-02-15 20:35:17 +00:00
parent 0655c1b34c
commit 745375f393
3 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,7 @@ ISmmPluginManager *g_pMMPlugins = NULL;
CGlobalVars *gpGlobals = NULL;
ICvar *icvar = NULL;
IGameEventManager2 *gameevents = NULL;
CallClass<IVEngineServer> *enginePatch = NULL;
PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);

View File

@ -51,6 +51,9 @@ extern ICvar *icvar;
extern ISmmPluginManager *g_pMMPlugins;
extern CGlobalVars *gpGlobals;
extern IGameEventManager2 *gameevents;
extern SourceHook::CallClass<IVEngineServer> *enginePatch;
#define ENGINE_CALL(func) SH_CALL(enginePatch, &IVEngineServer::func)
PLUGIN_GLOBALVARS();

View File

@ -156,6 +156,8 @@ void SourceModBase::StartSourceMod(bool late)
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);
enginePatch = SH_GET_CALLCLASS(engine);
/* Notify! */
SMGlobalClass *pBase = SMGlobalClass::head;
while (pBase)
@ -314,6 +316,12 @@ void SourceModBase::CloseSourceMod()
pBase = pBase->m_pGlobalClassNext;
}
if (enginePatch)
{
SH_RELEASE_CALLCLASS(enginePatch);
enginePatch = NULL;
}
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);