diff -r 4228d058d7cb -r 0492209c065f sourcemm/sourcemm.cpp --- a/sourcemm/sourcemm.cpp Mon Feb 19 13:17:07 2007 +0000 +++ b/sourcemm/sourcemm.cpp Wed Feb 21 01:51:54 2007 +0000 @@ -32,6 +32,7 @@ SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool); SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *); SH_DECL_HOOK0(IServerGameDLL, GameInit, SH_NOATTRIB, false, bool); + bool DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory, CreateInterfaceFn filesystemFactory, CGlobalVars *pGlobals); bool DLLInit_Post(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory, CreateInterfaceFn filesystemFactory, CGlobalVars *pGlobals); void DLLShutdown_handler(); @@ -50,7 +51,7 @@ bool gParsedGameInfo = false; bool bGameInit = false; SourceHook::List gamedll_list; -SourceHook::CallClass *dllExec; +SourceHook::CallClass *g_GameDllPatch; int g_GameDllVersion = 0; void ClearGamedllList(); @@ -145,12 +146,21 @@ //Initialize our console hooks ConCommandBaseMgr::OneTimeInit(static_cast(&g_SMConVarAccessor)); + g_GameDllPatch = SH_GET_CALLCLASS(g_GameDll.pGameDLL); + if (!g_SmmAPI.CacheCmds()) { LogMessage("[META] Warning: Failed to initialize Con_Printf. Defaulting to Msg()."); LogMessage("[META] Warning: Console messages will not be redirected to rcon console."); } + if (!g_SmmAPI.CacheUserMessages()) + { + /* Don't know of a mod that has stripped out user messages completely, + but perhaps should do something different here? */ + LogMessage("[META] Warning: Failed to get list of user messages."); + LogMessage("[META] Warning: The 'meta game' command will not display user messages."); + } const char *pluginFile = g_Engine.icvar->GetCommandLineValue("mm_pluginsfile"); if (!pluginFile) @@ -165,8 +175,6 @@ bInFirstLevel = true; - dllExec = SH_GET_CALLCLASS(g_GameDll.pGameDLL); - RETURN_META_VALUE(MRES_IGNORED, true); } @@ -184,7 +192,7 @@ bGameInit = true; - return true; + RETURN_META_VALUE(MRES_IGNORED, true); } bool DLLInit_Post(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory, CreateInterfaceFn filesystemFactory, CGlobalVars *pGlobals) @@ -524,10 +532,10 @@ g_SMConVarAccessor.MarkCommandsAsGameDLL(); g_SMConVarAccessor.UnregisterGameDLLCommands(); - SH_CALL(dllExec, &IServerGameDLL::DLLShutdown)(); + SH_CALL(g_GameDllPatch, &IServerGameDLL::DLLShutdown)(); - SH_RELEASE_CALLCLASS(dllExec); - dllExec = NULL; + SH_RELEASE_CALLCLASS(g_GameDllPatch); + g_GameDllPatch = NULL; g_SourceHook.CompleteShutdown(); @@ -724,7 +732,7 @@ bool LevelInit_handler(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) { - if (!g_SmmAPI.CacheSuccessful()) + if (!g_SmmAPI.CmdCacheSuccessful()) { LogMessage("[META] Warning: Failed to initialize Con_Printf. Defaulting to Msg()."); LogMessage("[META] Warning: Console messages will not be redirected to rcon console.");