mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-13 03:44:05 +02:00
fix float detection in console, fixes stuff like !set type all 0.8C
This commit is contained in:
@@ -80,6 +80,7 @@ ValueType TPTScriptInterface::testType(std::string word)
|
|||||||
return TypeFunction;
|
return TypeFunction;
|
||||||
else if (word == "quit")
|
else if (word == "quit")
|
||||||
return TypeFunction;
|
return TypeFunction;
|
||||||
|
|
||||||
//Basic type
|
//Basic type
|
||||||
for (i = 0; i < word.length(); i++)
|
for (i = 0; i < word.length(); i++)
|
||||||
{
|
{
|
||||||
@@ -99,13 +100,15 @@ ValueType TPTScriptInterface::testType(std::string word)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TypeNumber;
|
return TypeNumber;
|
||||||
|
|
||||||
parseFloat:
|
parseFloat:
|
||||||
for (i++; i < word.length(); i++)
|
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;
|
goto parseString;
|
||||||
}
|
}
|
||||||
return TypeFloat;
|
return TypeFloat;
|
||||||
|
|
||||||
parseNumberHex:
|
parseNumberHex:
|
||||||
for (i++; i < word.length(); i++)
|
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') || (rawWord[i] >= 'a' && rawWord[i] <= 'f') || (rawWord[i] >= 'A' && rawWord[i] <= 'F')))
|
||||||
@@ -113,6 +116,7 @@ ValueType TPTScriptInterface::testType(std::string word)
|
|||||||
goto parseString;
|
goto parseString;
|
||||||
}
|
}
|
||||||
return TypeNumber;
|
return TypeNumber;
|
||||||
|
|
||||||
parsePoint:
|
parsePoint:
|
||||||
for (i++; i < word.length(); i++)
|
for (i++; i < word.length(); i++)
|
||||||
if (!(rawWord[i] >= '0' && rawWord[i] <= '9'))
|
if (!(rawWord[i] >= '0' && rawWord[i] <= '9'))
|
||||||
@@ -120,6 +124,7 @@ ValueType TPTScriptInterface::testType(std::string word)
|
|||||||
goto parseString;
|
goto parseString;
|
||||||
}
|
}
|
||||||
return TypePoint;
|
return TypePoint;
|
||||||
|
|
||||||
parseString:
|
parseString:
|
||||||
return TypeString;
|
return TypeString;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user