mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Reverted a change
This commit is contained in:
parent
f2e34075b8
commit
bf5374adbf
|
@ -79,8 +79,8 @@ public:
|
||||||
virtual void StoreCommands(bool Store) = 0;
|
virtual void StoreCommands(bool Store) = 0;
|
||||||
|
|
||||||
virtual bool LineIsValid(const char *pStr) = 0;
|
virtual bool LineIsValid(const char *pStr) = 0;
|
||||||
virtual bool ExecuteLine(const char *Sptr, int ClientID = -1) = 0;
|
virtual void ExecuteLine(const char *Sptr, int ClientID = -1) = 0;
|
||||||
virtual bool ExecuteLineStroked(int Stroke, const char *pStr, 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 void ExecuteFile(const char *pFilename, int ClientID = -1) = 0;
|
||||||
|
|
||||||
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData) = 0;
|
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData) = 0;
|
||||||
|
|
|
@ -253,7 +253,7 @@ bool CConsole::LineIsValid(const char *pStr)
|
||||||
return true;
|
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)
|
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)
|
if(ParseStart(&Result, pStr, (pEnd-pStr) + 1) != 0)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if(!*Result.m_pCommand)
|
if(!*Result.m_pCommand)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
CCommand *pCommand = FindCommand(Result.m_pCommand, m_FlagMask);
|
CCommand *pCommand = FindCommand(Result.m_pCommand, m_FlagMask);
|
||||||
|
|
||||||
|
@ -324,12 +324,11 @@ bool CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(pCommand->m_Flags&CMDFLAG_TEST && !g_Config.m_SvTestingCommands)
|
if(pCommand->m_Flags&CMDFLAG_TEST && !g_Config.m_SvTestingCommands)
|
||||||
return false;
|
return;
|
||||||
pCommand->m_pfnCallback(&Result, pCommand->m_pUserData);
|
pCommand->m_pfnCallback(&Result, pCommand->m_pUserData);
|
||||||
if (pCommand->m_Flags&CMDFLAG_TEST) {
|
if (pCommand->m_Flags&CMDFLAG_TEST)
|
||||||
m_Cheated = true;
|
m_Cheated = true;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +348,6 @@ bool CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
|
||||||
|
|
||||||
pStr = pNextPart;
|
pStr = pNextPart;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConsole::PossibleCommands(const char *pStr, int FlagMask, bool Temp, FPossibleCallback pfnCallback, void *pUser)
|
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;
|
return 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConsole::ExecuteLine(const char *pStr, int ClientID)
|
void CConsole::ExecuteLine(const char *pStr, int ClientID)
|
||||||
{
|
{
|
||||||
bool Press = false, Release = false;
|
CConsole::ExecuteLineStroked(1, pStr); // press it
|
||||||
Press = CConsole::ExecuteLineStroked(1, pStr, ClientID); // press it
|
CConsole::ExecuteLineStroked(0, pStr); // then release it
|
||||||
Release = CConsole::ExecuteLineStroked(0, pStr, ClientID); // then release it
|
|
||||||
return Press || Release;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ class CConsole : public IConsole
|
||||||
static void ConModCommandStatus(IConsole::IResult *pResult, void *pUser);
|
static void ConModCommandStatus(IConsole::IResult *pResult, void *pUser);
|
||||||
|
|
||||||
void ExecuteFileRecurse(const char *pFilename);
|
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
|
struct
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ public:
|
||||||
virtual void StoreCommands(bool Store);
|
virtual void StoreCommands(bool Store);
|
||||||
|
|
||||||
virtual bool LineIsValid(const char *pStr);
|
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 void ExecuteFile(const char *pFilename, int ClientID = -1);
|
||||||
|
|
||||||
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData);
|
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData);
|
||||||
|
|
|
@ -759,12 +759,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
||||||
else
|
else
|
||||||
Console()->SetAccessLevel(IConsole::ACCESS_LEVEL_USER);
|
Console()->SetAccessLevel(IConsole::ACCESS_LEVEL_USER);
|
||||||
// Todo(Shereef Marzouk): Follow up on the RCON/Chat redirection
|
// Todo(Shereef Marzouk): Follow up on the RCON/Chat redirection
|
||||||
if(!m_pChatCommands->ExecuteLine(pMsg->m_pMessage + 1, ClientID))
|
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);
|
|
||||||
}
|
|
||||||
Console()->SetAccessLevel(IConsole::ACCESS_LEVEL_ADMIN);
|
Console()->SetAccessLevel(IConsole::ACCESS_LEVEL_ADMIN);
|
||||||
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "chat",
|
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "chat",
|
||||||
pMsg->m_pMessage);
|
pMsg->m_pMessage);
|
||||||
|
|
Loading…
Reference in a new issue