From 033e829612345bbb0936e1656e88c75a979328f2 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 27 Feb 2020 20:43:30 -0600 Subject: [PATCH] Percent.One bugfix --- Wabbajack.Common/Util/Percent.cs | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/Wabbajack.Common/Util/Percent.cs b/Wabbajack.Common/Util/Percent.cs index bd0bc749..e1cc4414 100644 --- a/Wabbajack.Common/Util/Percent.cs +++ b/Wabbajack.Common/Util/Percent.cs @@ -6,11 +6,11 @@ namespace Wabbajack.Common { public struct Percent : IComparable, IEquatable { - public static readonly Percent One = new Percent(1); - public static readonly Percent Zero = new Percent(0); + public static readonly Percent One = new Percent(1d); + public static readonly Percent Zero = new Percent(0d); public readonly double Value; - public Percent Inverse => new Percent(1 - this.Value, check: false); + public Percent Inverse => new Percent(1d - this.Value, check: false); private Percent(double d, bool check) { @@ -24,9 +24,10 @@ namespace Wabbajack.Common } } - public Percent(long max, long current) : this((double)current / max) + public Percent(long max, long current) + : this((double)current / max) { - + } public Percent(double d) @@ -34,22 +35,6 @@ namespace Wabbajack.Common { } - public Percent(int i) - { - if (i < 0) - { - Value = 0; - } - else if (i > 100) - { - Value = 1; - } - else - { - Value = i / 100d; - } - } - public static bool InRange(double d) { return d >= 0 || d <= 1;