diff -r d601b515c839 -r b962785c4b1b sourcemm/sourcemm.cpp --- a/sourcemm/sourcemm.cpp Tue Apr 24 22:07:00 2007 +0000 +++ b/sourcemm/sourcemm.cpp Thu Apr 26 18:14:21 2007 +0000 @@ -119,15 +119,6 @@ SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelShutdown, g_GameDll.pGameDLL, LevelShutdown_handler, true); SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelInit, g_GameDll.pGameDLL, LevelInit_handler, true); SH_ADD_HOOK_STATICFUNC(IServerGameDLL, GameInit, g_GameDll.pGameDLL, GameInit_handler, false); - - if (g_GameDll.pGameClients) - { - SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, g_GameDll.pGameClients, ClientCommand_handler, false); - } else { - /* If IServerGameClients isn't found, this really isn't a fatal error so... */ - LogMessage("[META] Warning: Could not find IServerGameClients!"); - LogMessage("[META] Warning: The 'meta' command will not be available to clients."); - } } bool DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory, CreateInterfaceFn filesystemFactory, CGlobalVars *pGlobals) @@ -157,6 +148,15 @@ g_GameDllPatch = SH_GET_CALLCLASS(g_GameDll.pGameDLL); + if (g_GameDll.pGameClients) + { + SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, g_GameDll.pGameClients, ClientCommand_handler, false); + } else { + /* If IServerGameClients isn't found, this really isn't a fatal error so... */ + LogMessage("[META] Warning: Could not find IServerGameClients!"); + LogMessage("[META] Warning: The 'meta' command will not be available to clients."); + } + if (!g_SmmAPI.CacheCmds()) { LogMessage("[META] Warning: Failed to initialize Con_Printf. Defaulting to Msg()."); @@ -374,7 +374,6 @@ pInfo->lib = gamedll; pInfo->loaded = true; pInfo->pGameDLL = NULL; - pInfo->pGameClients = (IServerGameClients *)((fn)(INTERFACEVERSION_SERVERGAMECLIENTS, NULL)); gamedll_list.push_back(pInfo); break; } @@ -447,6 +446,15 @@ } } + /* We use this interface for responding to the meta client command */ + if (strncmp(iface, "ServerGameClients", 17) == 0) + { + void *ptr = (g_GameDll.factory)(iface, ret); + g_GameDll.pGameClients = static_cast(ptr); + + return ptr; + } + /* If we got here, there's definitely a GameDLL */ IFACE_MACRO(g_GameDll.factory, GameDLL); }