From 4f5db27701fcd7b9153abe6ca223d2b6cfbd3a18 Mon Sep 17 00:00:00 2001 From: ike709 Date: Thu, 24 Oct 2024 17:36:35 -0500 Subject: [PATCH] review shuffle --- OpenDreamClient/Interface/DMF/IDMFProperty.cs | 57 ++++++++----------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/OpenDreamClient/Interface/DMF/IDMFProperty.cs b/OpenDreamClient/Interface/DMF/IDMFProperty.cs index 462260aaa7..661ea118fa 100644 --- a/OpenDreamClient/Interface/DMF/IDMFProperty.cs +++ b/OpenDreamClient/Interface/DMF/IDMFProperty.cs @@ -222,38 +222,20 @@ public bool Equals(string comparison) { return comparisonVec.X == X && comparisonVec.Y == Y; } - public bool Equals(DMFPropertyVec2 other) - { + public bool Equals(DMFPropertyVec2 other) { return X == other.X && Y == other.Y && Delim == other.Delim; } - public override bool Equals(object? obj) - { + public override bool Equals(object? obj) { return obj is DMFPropertyVec2 other && Equals(other); } - public override int GetHashCode() - { + public override int GetHashCode() { return HashCode.Combine(X, Y, Delim); } } public struct DMFPropertySize : IDMFProperty, IEquatable { - public bool Equals(DMFPropertySize other) - { - return _value.Equals(other._value); - } - - public override bool Equals(object? obj) - { - return obj is DMFPropertySize other && Equals(other); - } - - public override int GetHashCode() - { - return _value.GetHashCode(); - } - private DMFPropertyVec2 _value; public int X {get => _value.X; set => _value.X = value;} public int Y {get => _value.Y; set => _value.Y = value;} @@ -320,26 +302,23 @@ public bool Equals(string comparison) { return _value.Equals(comparison); } - public static bool operator ==(DMFPropertySize a, DMFPropertySize b) => a.Vector == b.Vector; - public static bool operator !=(DMFPropertySize a, DMFPropertySize b) => a.Vector != b.Vector; -} - -public struct DMFPropertyPos : IDMFProperty, IEquatable { - public bool Equals(DMFPropertyPos other) - { + public bool Equals(DMFPropertySize other) { return _value.Equals(other._value); } - public override bool Equals(object? obj) - { - return obj is DMFPropertyPos other && Equals(other); + public override bool Equals(object? obj) { + return obj is DMFPropertySize other && Equals(other); } - public override int GetHashCode() - { + public override int GetHashCode() { return _value.GetHashCode(); } + public static bool operator ==(DMFPropertySize a, DMFPropertySize b) => a.Vector == b.Vector; + public static bool operator !=(DMFPropertySize a, DMFPropertySize b) => a.Vector != b.Vector; +} + +public struct DMFPropertyPos : IDMFProperty, IEquatable { private DMFPropertyVec2 _value; public int X => _value.X; public int Y => _value.Y; @@ -406,6 +385,18 @@ public bool Equals(string comparison) { return _value.Equals(comparison); } + public bool Equals(DMFPropertyPos other) { + return _value.Equals(other._value); + } + + public override bool Equals(object? obj) { + return obj is DMFPropertyPos other && Equals(other); + } + + public override int GetHashCode() { + return _value.GetHashCode(); + } + public static bool operator ==(DMFPropertyPos a, DMFPropertyPos b) => a.Vector == b.Vector; public static bool operator !=(DMFPropertyPos a, DMFPropertyPos b) => a.Vector != b.Vector; }