Fix compiling literal numbers
parent
5f089f4a9b
commit
17d0d2abb1
|
@ -74,8 +74,7 @@ CBotInstr* CompileExprLitNum(CBotToken* &p, CBotCStack* pStack)
|
||||||
if (s.find('.') != std::string::npos || ( s.find('x') == std::string::npos && ( s.find_first_of("eE") != std::string::npos ) ))
|
if (s.find('.') != std::string::npos || ( s.find('x') == std::string::npos && ( s.find_first_of("eE") != std::string::npos ) ))
|
||||||
{
|
{
|
||||||
double val = GetNumFloat(s);
|
double val = GetNumFloat(s);
|
||||||
if (val < static_cast<double>(std::numeric_limits<float>::min()) &&
|
if (val > static_cast<double>(std::numeric_limits<float>::max()))
|
||||||
val > static_cast<double>(std::numeric_limits<float>::max()) )
|
|
||||||
{
|
{
|
||||||
numtype = CBotTypDouble;
|
numtype = CBotTypDouble;
|
||||||
inst = new CBotExprLitNum<double>(val);
|
inst = new CBotExprLitNum<double>(val);
|
||||||
|
@ -89,8 +88,7 @@ CBotInstr* CompileExprLitNum(CBotToken* &p, CBotCStack* pStack)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long val = GetNumInt(s);
|
long val = GetNumInt(s);
|
||||||
if (val < std::numeric_limits<int>::min() &&
|
if (val > std::numeric_limits<int>::max())
|
||||||
val > std::numeric_limits<int>::max() )
|
|
||||||
{
|
{
|
||||||
numtype = CBotTypLong;
|
numtype = CBotTypLong;
|
||||||
inst = new CBotExprLitNum<long>(val);
|
inst = new CBotExprLitNum<long>(val);
|
||||||
|
|
Loading…
Reference in New Issue