core/PlayerManager.cpp
changeset 1544 feff70182207
parent 1541 e46ad208b9b4
child 1576 f36378b2d71f
     1.1 --- a/core/PlayerManager.cpp	Sun Oct 14 01:09:40 2007 +0000
     1.2 +++ b/core/PlayerManager.cpp	Sun Oct 14 02:30:16 2007 +0000
     1.3 @@ -44,6 +44,7 @@
     1.4  #include "Translator.h"
     1.5  #include "Logger.h"
     1.6  #include "ChatTriggers.h"
     1.7 +#include "HalfLife2.h"
     1.8  
     1.9  PlayerManager g_Players;
    1.10  bool g_OnMapStarted = false;
    1.11 @@ -586,12 +587,10 @@
    1.12  		return;
    1.13  	}
    1.14  
    1.15 -	/**
    1.16 -	 * We cache this because the engine is not re-entrant.
    1.17 -	 */
    1.18 -	char cmd[300];
    1.19 +	g_HL2.PushCommandStack(&args);
    1.20 +
    1.21  	int argcount = args.ArgC() - 1;
    1.22 -	strncopy(cmd, args.Arg(0), sizeof(cmd));
    1.23 +	const char *cmd = g_HL2.CurrentCommandName();
    1.24  
    1.25  	bool result = g_ValveMenuStyle.OnClientCommand(client, cmd, args);
    1.26  	if (result)
    1.27 @@ -617,11 +616,14 @@
    1.28  
    1.29  	if (res >= Pl_Stop)
    1.30  	{
    1.31 +		g_HL2.PopCommandStack();
    1.32  		RETURN_META(MRES_SUPERCEDE);
    1.33  	}
    1.34  
    1.35  	res = g_ConCmds.DispatchClientCommand(client, cmd, argcount, (ResultType)res);
    1.36  
    1.37 +	g_HL2.PopCommandStack();
    1.38 +
    1.39  	if (res >= Pl_Handled)
    1.40  	{
    1.41  		RETURN_META(MRES_SUPERCEDE);