Fixed a bug with /tpxy where the parameters didn't take floats or negative numbers

This commit is contained in:
bencie 2024-02-06 15:28:33 +01:00
parent 5186175f24
commit 5b2c35dc36

View file

@ -1638,11 +1638,11 @@ void CGameContext::ConTeleXY(IConsole::IResult *pResult, void *pUserData)
// Relative?
const char *pStrDelta = str_startswith(pInString, "~");
if(!str_isallnum(pStrDelta ? pStrDelta : pInString))
float d;
if(!str_tofloat(pStrDelta ? pStrDelta : pInString,&d))
return false;
// Is the number valid?
float d = str_tofloat(pStrDelta ? pStrDelta : pInString);
if(std::isnan(d) || std::isinf(d))
return false;