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:
parent
4fb6f5c5ed
commit
060ba0692d
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user