sourcemm/sourcemm.cpp
changeset 319 b962785c4b1b
parent 318 d601b515c839
child 335 5b6e54c9ed5f
     1.1 --- a/sourcemm/sourcemm.cpp	Tue Apr 24 22:07:00 2007 +0000
     1.2 +++ b/sourcemm/sourcemm.cpp	Thu Apr 26 18:14:21 2007 +0000
     1.3 @@ -119,15 +119,6 @@
     1.4  	SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelShutdown, g_GameDll.pGameDLL, LevelShutdown_handler, true);
     1.5  	SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelInit, g_GameDll.pGameDLL, LevelInit_handler, true);
     1.6  	SH_ADD_HOOK_STATICFUNC(IServerGameDLL, GameInit, g_GameDll.pGameDLL, GameInit_handler, false);
     1.7 -
     1.8 -	if (g_GameDll.pGameClients)
     1.9 -	{
    1.10 -		SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, g_GameDll.pGameClients, ClientCommand_handler, false);
    1.11 -	} else {
    1.12 -		/* If IServerGameClients isn't found, this really isn't a fatal error so... */
    1.13 -		LogMessage("[META] Warning: Could not find IServerGameClients!");
    1.14 -		LogMessage("[META] Warning: The 'meta' command will not be available to clients.");
    1.15 -	}
    1.16  }
    1.17  
    1.18  bool DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory, CreateInterfaceFn filesystemFactory, CGlobalVars *pGlobals)
    1.19 @@ -157,6 +148,15 @@
    1.20  
    1.21  	g_GameDllPatch = SH_GET_CALLCLASS(g_GameDll.pGameDLL);
    1.22  
    1.23 +	if (g_GameDll.pGameClients)
    1.24 +	{
    1.25 +		SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, g_GameDll.pGameClients, ClientCommand_handler, false);
    1.26 +	} else {
    1.27 +		/* If IServerGameClients isn't found, this really isn't a fatal error so... */
    1.28 +		LogMessage("[META] Warning: Could not find IServerGameClients!");
    1.29 +		LogMessage("[META] Warning: The 'meta' command will not be available to clients.");
    1.30 +	}
    1.31 +
    1.32  	if (!g_SmmAPI.CacheCmds())
    1.33  	{
    1.34  		LogMessage("[META] Warning: Failed to initialize Con_Printf.  Defaulting to Msg().");
    1.35 @@ -374,7 +374,6 @@
    1.36  					pInfo->lib = gamedll;
    1.37  					pInfo->loaded = true;
    1.38  					pInfo->pGameDLL = NULL;
    1.39 -					pInfo->pGameClients = (IServerGameClients *)((fn)(INTERFACEVERSION_SERVERGAMECLIENTS, NULL));
    1.40  					gamedll_list.push_back(pInfo);
    1.41  					break;
    1.42  				}
    1.43 @@ -447,6 +446,15 @@
    1.44  		}
    1.45  	}
    1.46  
    1.47 +	/* We use this interface for responding to the meta client command */
    1.48 +	if (strncmp(iface, "ServerGameClients", 17) == 0)
    1.49 +	{
    1.50 +		void *ptr = (g_GameDll.factory)(iface, ret);
    1.51 +		g_GameDll.pGameClients = static_cast<IServerGameClients *>(ptr);
    1.52 +
    1.53 +		return ptr;
    1.54 +	}
    1.55 +
    1.56  	/* If we got here, there's definitely a GameDLL */
    1.57  	IFACE_MACRO(g_GameDll.factory, GameDLL);
    1.58  }