1
0
forked from 0ad/0ad

Fix for misinterpretation of data types in XML

This was SVN commit r1512.
This commit is contained in:
MarkT 2004-12-16 09:41:41 +00:00
parent 851a30215f
commit da4c42ef58

View File

@ -250,14 +250,19 @@ jsval JSParseString( const CStrW& Native )
CParserLine result;
result.ParseString( stringParser, (CStr)Native );
bool boolResult; int intResult; float floatResult;
if( result.GetArgFloat( 0, floatResult ) )
{
if( floatResult == floor( floatResult ) )
{
intResult = (int)floatResult;
if( INT_FITS_IN_JSVAL( intResult ) )
return( ToJSVal( intResult ) );
}
return( ToJSVal( floatResult ) );
}
if( result.GetArgBool( 0, boolResult ) )
return( BOOLEAN_TO_JSVAL( boolResult ) );
if( result.GetArgInt( 0, intResult ) )
{
if( INT_FITS_IN_JSVAL( intResult ) )
return( ToJSVal( intResult ) );
}
if( result.GetArgFloat( 0, floatResult ) )
return( ToJSVal( floatResult ) );
return( ToJSVal( Native ) );
}