Simplify PerformanceCacheLookup

This commit is contained in:
Lucas A 2020-10-08 18:31:29 +02:00
parent cd15f83f85
commit fa201be2ad

View File

@ -9,7 +9,6 @@ using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Scoring namespace osu.Game.Scoring
{ {
@ -57,34 +56,21 @@ namespace osu.Game.Scoring
public readonly struct PerformanceCacheLookup public readonly struct PerformanceCacheLookup
{ {
public readonly double Accuracy; public readonly string ScoreHash;
public readonly int BeatmapId; public readonly int LocalId;
public readonly long TotalScore;
public readonly int Combo;
public readonly Mod[] Mods;
public readonly int RulesetId;
public PerformanceCacheLookup(ScoreInfo info) public PerformanceCacheLookup(ScoreInfo info)
{ {
Accuracy = info.Accuracy; ScoreHash = info.Hash;
BeatmapId = info.Beatmap.ID; LocalId = info.ID;
TotalScore = info.TotalScore;
Combo = info.Combo;
Mods = info.Mods;
RulesetId = info.Ruleset.ID ?? 0;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
var hash = new HashCode(); var hash = new HashCode();
hash.Add(Accuracy); hash.Add(ScoreHash);
hash.Add(BeatmapId); hash.Add(LocalId);
hash.Add(TotalScore);
hash.Add(Combo);
hash.Add(RulesetId);
foreach (var mod in Mods)
hash.Add(mod);
return hash.ToHashCode(); return hash.ToHashCode();
} }