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

Add hash code support for Mod

This commit is contained in:
Salman Ahmed 2021-08-17 04:27:04 +03:00
parent 4fb6f5c5ed
commit 060ba0692d

View File

@ -197,6 +197,18 @@ namespace osu.Game.Rulesets.Mods
ModUtils.GetSettingUnderlyingValue(pair.Item2.GetValue(other))));
}
public override int GetHashCode()
{
var hashCode = new HashCode();
hashCode.Add(GetType());
foreach (var (_, prop) in this.GetSettingsSourceProperties())
hashCode.Add(ModUtils.GetSettingUnderlyingValue(prop.GetValue(this)));
return hashCode.ToHashCode();
}
/// <summary>
/// Reset all custom settings for this mod back to their defaults.
/// </summary>