Skip to content

Commit

Permalink
shush sharper
Browse files Browse the repository at this point in the history
  • Loading branch information
amylizzle committed Jan 15, 2025
1 parent 78fafe2 commit 520da17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions OpenDreamShared/Dream/ImmutableAppearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public bool TryGetId([NotNullWhen(true)] out uint? id) {
return _registeredId is not null;
}

// ResSharper disable NonReadonlyMemberInGetHashCode
public override int GetHashCode() {
if(_storedHashCode is not null) //because everything is readonly, this only needs to be done once
return (int)_storedHashCode;
Expand Down Expand Up @@ -268,6 +269,7 @@ public override int GetHashCode() {
_storedHashCode = hashCode.ToHashCode();
return (int)_storedHashCode;
}
// ResSharper enable NonReadonlyMemberInGetHashCode

public ImmutableAppearance(NetIncomingMessage buffer, IRobustSerializer serializer) {
Overlays = [];
Expand Down
2 changes: 2 additions & 0 deletions OpenDreamShared/Dream/MutableAppearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private static bool TryRepresentMatrixAsRgbaColor(in ColorMatrix matrix, [NotNul
return maybeColor is not null;
}

// ResSharper disable NonReadonlyMemberInGetHashCode
//it is *ESSENTIAL* that this matches the hashcode of the equivelant ImmutableAppearance. There's a debug assert and everything.
public override int GetHashCode() {
HashCode hashCode = new HashCode();
Expand Down Expand Up @@ -291,6 +292,7 @@ public override int GetHashCode() {

return hashCode.ToHashCode();
}
// ResSharper enable NonReadonlyMemberInGetHashCode

/// <summary>
/// Parses the given colour string and sets this appearance to use it.
Expand Down

0 comments on commit 520da17

Please sign in to comment.