From 17987918dedb67aa2167d4496b33ae868c465e72 Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Mon, 1 Jun 2020 11:12:52 +0200 Subject: [PATCH] Fixed a bug where modifying a user_ ZScript variable through the custom properties tab would cause a crash. Fixes #420. --- Source/Core/Types/FloatHandler.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Core/Types/FloatHandler.cs b/Source/Core/Types/FloatHandler.cs index 61634d6cf..fab04e039 100755 --- a/Source/Core/Types/FloatHandler.cs +++ b/Source/Core/Types/FloatHandler.cs @@ -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 -- GitLab