mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 12:50:52 +00:00
Fixed a bug where modifying a user_ ZScript variable through the custom properties tab would cause a crash. Fixes #420.
This commit is contained in:
parent
e3e76c2b40
commit
17987918de
1 changed files with 8 additions and 8 deletions
|
@ -32,7 +32,7 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
private float value;
|
||||
private double value;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -47,25 +47,25 @@ namespace CodeImp.DoomBuilder.Types
|
|||
// Null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = 0.0f;
|
||||
this.value = 0.0;
|
||||
}
|
||||
// Compatible type?
|
||||
else if((value is int) || (value is float) || (value is bool))
|
||||
else if((value is int) || (value is float) || (value is double) || (value is bool))
|
||||
{
|
||||
// Set directly
|
||||
this.value = Convert.ToSingle(value);
|
||||
this.value = Convert.ToDouble(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try parsing as string
|
||||
float result;
|
||||
if(float.TryParse(value.ToString(), NumberStyles.Float, CultureInfo.CurrentCulture, out result))
|
||||
double result;
|
||||
if(double.TryParse(value.ToString(), NumberStyles.Float, CultureInfo.CurrentCulture, out result))
|
||||
{
|
||||
this.value = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.value = 0.0f;
|
||||
this.value = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
public override object GetDefaultValue()
|
||||
{
|
||||
return 0f;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue