mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
Configuration file parser: floating point numbers without the "f" suffix are now parsed as double precision floating point numbers
This commit is contained in:
parent
0fc2296ce9
commit
8330c70a41
1 changed files with 14 additions and 1 deletions
|
@ -706,7 +706,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
// is also the end of the assignment
|
||||
pos--;
|
||||
|
||||
// Floating point?
|
||||
// Floating point of single precision?
|
||||
if(val.IndexOf("f", StringComparison.Ordinal) > -1)
|
||||
{
|
||||
float fval;
|
||||
|
@ -721,6 +721,19 @@ namespace CodeImp.DoomBuilder.IO
|
|||
}
|
||||
return fval;
|
||||
}
|
||||
else if(val.IndexOf(".", StringComparison.Ordinal) > -1) // Floating point of double precision?
|
||||
{
|
||||
double dval;
|
||||
|
||||
try { dval = Convert.ToDouble(val.Trim(), CultureInfo.InvariantCulture); }
|
||||
catch(FormatException)
|
||||
{
|
||||
// ERROR: Invalid value in assignment
|
||||
RaiseError(file, line, ERROR_VALUEINVALID);
|
||||
return null;
|
||||
}
|
||||
return dval;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Convert to int
|
||||
|
|
Loading…
Reference in a new issue