mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Fix tpxy arg validation
This commit is contained in:
parent
5b0163d069
commit
796fa4275f
|
@ -136,7 +136,7 @@ int CConsole::ParseStart(CResult *pResult, const char *pString, int Length)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CConsole::ParseArgs(CResult *pResult, const char *pFormat, FCommandCallback pfnCallback)
|
||||
int CConsole::ParseArgs(CResult *pResult, const char *pFormat, bool IsColor)
|
||||
{
|
||||
char Command = *pFormat;
|
||||
char *pStr;
|
||||
|
@ -235,7 +235,7 @@ int CConsole::ParseArgs(CResult *pResult, const char *pFormat, FCommandCallback
|
|||
if(Command == 'i')
|
||||
{
|
||||
// don't validate colors here
|
||||
if(pfnCallback != &SColorConfigVariable::CommandCallback)
|
||||
if(!IsColor)
|
||||
{
|
||||
int Value;
|
||||
if(!str_toint(pResult->GetString(pResult->NumArguments() - 1), &Value) ||
|
||||
|
@ -514,7 +514,7 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientId, bo
|
|||
|
||||
if(Stroke || IsStrokeCommand)
|
||||
{
|
||||
if(int Error = ParseArgs(&Result, pCommand->m_pParams, pCommand->m_pfnCallback))
|
||||
if(int Error = ParseArgs(&Result, pCommand->m_pParams, pCommand->m_pfnCallback == &SColorConfigVariable::CommandCallback))
|
||||
{
|
||||
char aBuf[CMDLINE_LENGTH + 64];
|
||||
if(Error == PARSEARGS_INVALID_INTEGER)
|
||||
|
|
|
@ -153,7 +153,7 @@ class CConsole : public IConsole
|
|||
PARSEARGS_INVALID_FLOAT,
|
||||
};
|
||||
|
||||
int ParseArgs(CResult *pResult, const char *pFormat, FCommandCallback pfnCallback = 0);
|
||||
int ParseArgs(CResult *pResult, const char *pFormat, bool IsColor = false);
|
||||
|
||||
/*
|
||||
this function will set pFormat to the next parameter (i,s,r,v,?) it contains and
|
||||
|
|
|
@ -3778,7 +3778,7 @@ void CGameContext::RegisterChatCommands()
|
|||
Console()->Register("rescuemode", "?r['auto'|'manual']", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConRescueMode, this, "Sets one of the two rescue modes (auto or manual). Prints current mode if no arguments provided");
|
||||
Console()->Register("tp", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleTo, this, "Depending on the number of supplied arguments, teleport yourself to; (0.) where you are spectating or aiming; (1.) the specified player name");
|
||||
Console()->Register("teleport", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleTo, this, "Depending on the number of supplied arguments, teleport yourself to; (0.) where you are spectating or aiming; (1.) the specified player name");
|
||||
Console()->Register("tpxy", "f[x] f[y]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleXY, this, "Teleport yourself to the specified coordinates. A tilde (~) can be used to denote your current position, e.g. '/tpxy ~1 ~' to teleport one tile to the right");
|
||||
Console()->Register("tpxy", "s[x] s[y]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleXY, this, "Teleport yourself to the specified coordinates. A tilde (~) can be used to denote your current position, e.g. '/tpxy ~1 ~' to teleport one tile to the right");
|
||||
Console()->Register("lasttp", "", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConLastTele, this, "Teleport yourself to the last location you teleported to");
|
||||
Console()->Register("tc", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
Console()->Register("telecursor", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
|
|
Loading…
Reference in a new issue