fix float detection in console, fixes stuff like !set type all 0.8C

This commit is contained in:
jacob1 2016-09-10 12:46:15 -04:00
parent 86fef64309
commit 797f9357ff

View File

@ -80,6 +80,7 @@ ValueType TPTScriptInterface::testType(std::string word)
return TypeFunction;
else if (word == "quit")
return TypeFunction;
//Basic type
for (i = 0; i < word.length(); i++)
{
@ -99,13 +100,15 @@ ValueType TPTScriptInterface::testType(std::string word)
}
}
return TypeNumber;
parseFloat:
for (i++; i < word.length(); i++)
if (!((rawWord[i] >= '0' && rawWord[i] <= '9') || (rawWord[i] >= 'a' && rawWord[i] <= 'f') || (rawWord[i] >= 'A' && rawWord[i] <= 'F')))
if (!((rawWord[i] >= '0' && rawWord[i] <= '9')))
{
goto parseString;
}
return TypeFloat;
parseNumberHex:
for (i++; i < word.length(); i++)
if (!((rawWord[i] >= '0' && rawWord[i] <= '9') || (rawWord[i] >= 'a' && rawWord[i] <= 'f') || (rawWord[i] >= 'A' && rawWord[i] <= 'F')))
@ -113,6 +116,7 @@ ValueType TPTScriptInterface::testType(std::string word)
goto parseString;
}
return TypeNumber;
parsePoint:
for (i++; i < word.length(); i++)
if (!(rawWord[i] >= '0' && rawWord[i] <= '9'))
@ -120,6 +124,7 @@ ValueType TPTScriptInterface::testType(std::string word)
goto parseString;
}
return TypePoint;
parseString:
return TypeString;
}