1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:26:07 +08:00

Fix bad equality comparer implementations

This commit is contained in:
smoogipoo 2020-12-01 18:09:21 +09:00
parent b780fdbe4c
commit dda4d76d72
3 changed files with 5 additions and 4 deletions

View File

@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Objects
=> other != null;
public override bool Equals(object obj)
=> Equals((BananaHitSampleInfo)obj);
=> obj is BananaHitSampleInfo other && Equals(other);
public override int GetHashCode() => lookup_names.GetHashCode();
}

View File

@ -83,7 +83,7 @@ namespace osu.Game.Audio
=> other != null && Name == other.Name && Bank == other.Bank && Suffix == other.Suffix;
public override bool Equals(object? obj)
=> Equals((HitSampleInfo?)obj);
=> obj is HitSampleInfo other && Equals(other);
public override int GetHashCode() => HashCode.Combine(Name, Bank, Suffix);
}

View File

@ -496,7 +496,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
public bool Equals(LegacyHitSampleInfo? other)
=> base.Equals(other) && CustomSampleBank == other.CustomSampleBank && IsLayered == other.IsLayered;
public override bool Equals(object? obj) => Equals((LegacyHitSampleInfo?)obj);
public override bool Equals(object? obj)
=> obj is LegacyHitSampleInfo other && Equals(other);
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), CustomSampleBank, IsLayered);
}
@ -529,7 +530,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
=> base.Equals(other) && Filename == other.Filename;
public override bool Equals(object? obj)
=> Equals((FileHitSampleInfo?)obj);
=> obj is FileHitSampleInfo other && Equals(other);
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Filename);
}