diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp index 7c8a84ad6..3e18b23d6 100644 --- a/src/engine/shared/console.cpp +++ b/src/engine/shared/console.cpp @@ -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) diff --git a/src/engine/shared/console.h b/src/engine/shared/console.h index c3779c6a2..2636c456e 100644 --- a/src/engine/shared/console.h +++ b/src/engine/shared/console.h @@ -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 diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 61faa6a29..f88d12dc4 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -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");