mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
commit
d1d492e76c
@ -6,11 +6,11 @@ namespace Wabbajack.Common
|
||||
{
|
||||
public struct Percent : IComparable, IEquatable<Percent>
|
||||
{
|
||||
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,7 +24,8 @@ namespace Wabbajack.Common
|
||||
}
|
||||
}
|
||||
|
||||
public Percent(long max, long current) : this((double)current / max)
|
||||
public Percent(long max, long current)
|
||||
: this((double)current / max)
|
||||
{
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user