fixed bug amb571 (FakeClientCommand having weird side effects)
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401341
This commit is contained in:
parent
4016c52a38
commit
84a08ba000
@ -155,11 +155,8 @@ void ConCmdManager::SetCommandClient(int client)
|
||||
m_CmdClient = client + 1;
|
||||
}
|
||||
|
||||
ResultType ConCmdManager::DispatchClientCommand(int client, ResultType type)
|
||||
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
|
||||
{
|
||||
const char *cmd = engine->Cmd_Argv(0);
|
||||
int args = engine->Cmd_Argc() - 1;
|
||||
|
||||
ConCmdInfo *pInfo;
|
||||
if (sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
int adminflags,
|
||||
const char *description,
|
||||
int flags);
|
||||
ResultType DispatchClientCommand(int client, ResultType type);
|
||||
ResultType DispatchClientCommand(int client, const char *cmd, int args, ResultType type);
|
||||
void UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits);
|
||||
bool LookForSourceModCommand(const char *cmd);
|
||||
bool CheckCommandAccess(int client, const char *cmd, FlagBits flags);
|
||||
|
@ -96,10 +96,8 @@ bool CRadioStyle::IsSupported()
|
||||
return (g_ShowMenuId != -1);
|
||||
}
|
||||
|
||||
bool CRadioStyle::OnClientCommand(int client)
|
||||
bool CRadioStyle::OnClientCommand(int client, const char *cmd)
|
||||
{
|
||||
const char *cmd = engine->Cmd_Argv(0);
|
||||
|
||||
if (strcmp(cmd, "menuselect") == 0)
|
||||
{
|
||||
if (!m_players[client].bInMenu)
|
||||
|
@ -70,7 +70,7 @@ public: //IUserMessageListener
|
||||
void OnUserMessageSent(int msg_id);
|
||||
public:
|
||||
bool IsSupported();
|
||||
bool OnClientCommand(int client);
|
||||
bool OnClientCommand(int client, const char *cmd);
|
||||
public:
|
||||
CRadioDisplay *MakeRadioDisplay(CRadioMenu *menu=NULL);
|
||||
void FreeRadioDisplay(CRadioDisplay *display);
|
||||
|
@ -53,10 +53,8 @@ CBaseMenuPlayer *ValveMenuStyle::GetMenuPlayer(int client)
|
||||
return &m_players[client];
|
||||
}
|
||||
|
||||
bool ValveMenuStyle::OnClientCommand(int client)
|
||||
bool ValveMenuStyle::OnClientCommand(int client, const char *cmd)
|
||||
{
|
||||
const char *cmd = engine->Cmd_Argv(0);
|
||||
|
||||
if (strcmp(cmd, "sm_vmenuselect") == 0)
|
||||
{
|
||||
int key_press = atoi(engine->Cmd_Argv(1));
|
||||
|
@ -59,7 +59,7 @@ class ValveMenuStyle :
|
||||
{
|
||||
public:
|
||||
ValveMenuStyle();
|
||||
bool OnClientCommand(int client);
|
||||
bool OnClientCommand(int client, const char *cmd);
|
||||
public: //BaseMenuStyle
|
||||
CBaseMenuPlayer *GetMenuPlayer(int client);
|
||||
void SendDisplay(int client, IMenuPanel *display);
|
||||
|
@ -535,23 +535,28 @@ void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
||||
|
||||
void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
{
|
||||
/**
|
||||
* We cache this because the engine is not re-entrant.
|
||||
*/
|
||||
char cmd[300];
|
||||
int args = engine->Cmd_Argc() - 1;
|
||||
strncopy(cmd, engine->Cmd_Argv(0), sizeof(cmd));
|
||||
|
||||
int client = engine->IndexOfEdict(pEntity);
|
||||
cell_t res = Pl_Continue;
|
||||
|
||||
bool result = g_ValveMenuStyle.OnClientCommand(client);
|
||||
bool result = g_ValveMenuStyle.OnClientCommand(client, cmd);
|
||||
if (result)
|
||||
{
|
||||
res = Pl_Handled;
|
||||
} else {
|
||||
result = g_RadioMenuStyle.OnClientCommand(client);
|
||||
result = g_RadioMenuStyle.OnClientCommand(client, cmd);
|
||||
if (result)
|
||||
{
|
||||
res = Pl_Handled;
|
||||
}
|
||||
}
|
||||
|
||||
int args = engine->Cmd_Argc() - 1;
|
||||
|
||||
cell_t res2 = Pl_Continue;
|
||||
m_clcommand->PushCell(client);
|
||||
m_clcommand->PushCell(args);
|
||||
@ -567,7 +572,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
|
||||
res = g_ConCmds.DispatchClientCommand(client, (ResultType)res);
|
||||
res = g_ConCmds.DispatchClientCommand(client, cmd, args, (ResultType)res);
|
||||
|
||||
if (res >= Pl_Handled)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user