Reverted a change

This commit is contained in:
GreYFoX 2011-08-31 02:48:58 +02:00
parent f2e34075b8
commit bf5374adbf
4 changed files with 14 additions and 23 deletions

View file

@ -79,8 +79,8 @@ public:
virtual void StoreCommands(bool Store) = 0;
virtual bool LineIsValid(const char *pStr) = 0;
virtual bool ExecuteLine(const char *Sptr, int ClientID = -1) = 0;
virtual bool ExecuteLineStroked(int Stroke, const char *pStr, int ClientID = -1) = 0;
virtual void ExecuteLine(const char *Sptr, int ClientID = -1) = 0;
virtual void ExecuteLineStroked(int Stroke, const char *pStr, int ClientID = -1) = 0;
virtual void ExecuteFile(const char *pFilename, int ClientID = -1) = 0;
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData) = 0;

View file

@ -253,7 +253,7 @@ bool CConsole::LineIsValid(const char *pStr)
return true;
}
bool CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
{
while(pStr && *pStr)
{
@ -287,10 +287,10 @@ bool CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
}
if(ParseStart(&Result, pStr, (pEnd-pStr) + 1) != 0)
return false;
return;
if(!*Result.m_pCommand)
return false;
return;
CCommand *pCommand = FindCommand(Result.m_pCommand, m_FlagMask);
@ -324,12 +324,11 @@ bool CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
else
{
if(pCommand->m_Flags&CMDFLAG_TEST && !g_Config.m_SvTestingCommands)
return false;
return;
pCommand->m_pfnCallback(&Result, pCommand->m_pUserData);
if (pCommand->m_Flags&CMDFLAG_TEST) {
if (pCommand->m_Flags&CMDFLAG_TEST)
m_Cheated = true;
}
return true;
}
}
}
@ -349,7 +348,6 @@ bool CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
pStr = pNextPart;
}
return false;
}
void CConsole::PossibleCommands(const char *pStr, int FlagMask, bool Temp, FPossibleCallback pfnCallback, void *pUser)
@ -378,12 +376,10 @@ CConsole::CCommand *CConsole::FindCommand(const char *pName, int FlagMask)
return 0x0;
}
bool CConsole::ExecuteLine(const char *pStr, int ClientID)
void CConsole::ExecuteLine(const char *pStr, int ClientID)
{
bool Press = false, Release = false;
Press = CConsole::ExecuteLineStroked(1, pStr, ClientID); // press it
Release = CConsole::ExecuteLineStroked(0, pStr, ClientID); // then release it
return Press || Release;
CConsole::ExecuteLineStroked(1, pStr); // press it
CConsole::ExecuteLineStroked(0, pStr); // then release it
}

View file

@ -58,7 +58,7 @@ class CConsole : public IConsole
static void ConModCommandStatus(IConsole::IResult *pResult, void *pUser);
void ExecuteFileRecurse(const char *pFilename);
bool ExecuteLineStroked(int Stroke, const char *pStr, int ClientID = -1);
void ExecuteLineStroked(int Stroke, const char *pStr, int ClientID = -1);
struct
{
@ -169,7 +169,7 @@ public:
virtual void StoreCommands(bool Store);
virtual bool LineIsValid(const char *pStr);
virtual bool ExecuteLine(const char *pStr, int ClientID = -1);
virtual void ExecuteLine(const char *pStr, int ClientID = -1);
virtual void ExecuteFile(const char *pFilename, int ClientID = -1);
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData);

View file

@ -759,12 +759,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
else
Console()->SetAccessLevel(IConsole::ACCESS_LEVEL_USER);
// Todo(Shereef Marzouk): Follow up on the RCON/Chat redirection
if(!m_pChatCommands->ExecuteLine(pMsg->m_pMessage + 1, ClientID))
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "The execution of the line '%s' has been denied (maybe the admin didn't allow the command for users).", pMsg->m_pMessage + 1);
SendChatTarget(ClientID, aBuf);
}
m_pChatCommands->ExecuteLine(pMsg->m_pMessage + 1, ClientID);
Console()->SetAccessLevel(IConsole::ACCESS_LEVEL_ADMIN);
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "chat",
pMsg->m_pMessage);