core/PlayerManager.cpp
changeset 1335 2047dc42d800
parent 1330 ab94316bb52b
child 1350 d5af97658c2e
     1.1 --- a/core/PlayerManager.cpp	Wed Aug 15 16:21:28 2007 +0000
     1.2 +++ b/core/PlayerManager.cpp	Wed Aug 15 17:14:48 2007 +0000
     1.3 @@ -535,23 +535,28 @@
     1.4  
     1.5  void PlayerManager::OnClientCommand(edict_t *pEntity)
     1.6  {
     1.7 +	/**
     1.8 +	 * We cache this because the engine is not re-entrant.
     1.9 +	 */
    1.10 +	char cmd[300];
    1.11 +	int args = engine->Cmd_Argc() - 1;
    1.12 +	strncopy(cmd, engine->Cmd_Argv(0), sizeof(cmd));
    1.13 +
    1.14  	int client = engine->IndexOfEdict(pEntity);
    1.15  	cell_t res = Pl_Continue;
    1.16  
    1.17 -	bool result = g_ValveMenuStyle.OnClientCommand(client);
    1.18 +	bool result = g_ValveMenuStyle.OnClientCommand(client, cmd);
    1.19  	if (result)
    1.20  	{
    1.21  		res = Pl_Handled;
    1.22  	} else {
    1.23 -		result = g_RadioMenuStyle.OnClientCommand(client);
    1.24 +		result = g_RadioMenuStyle.OnClientCommand(client, cmd);
    1.25  		if (result)
    1.26  		{
    1.27  			res = Pl_Handled;
    1.28  		}
    1.29  	}
    1.30  
    1.31 -	int args = engine->Cmd_Argc() - 1;
    1.32 -
    1.33  	cell_t res2 = Pl_Continue;
    1.34  	m_clcommand->PushCell(client);
    1.35  	m_clcommand->PushCell(args);
    1.36 @@ -567,7 +572,7 @@
    1.37  		RETURN_META(MRES_SUPERCEDE);
    1.38  	}
    1.39  
    1.40 -	res = g_ConCmds.DispatchClientCommand(client, (ResultType)res);
    1.41 +	res = g_ConCmds.DispatchClientCommand(client, cmd, args, (ResultType)res);
    1.42  
    1.43  	if (res >= Pl_Handled)
    1.44  	{