From 920710e7d0b3e37f027becbe059394f8e1345eb2 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Mon, 14 Aug 2017 13:30:54 +0200 Subject: [PATCH] Assign a score's beatmap and cleanup to the Score class --- osu.Game/Rulesets/Scoring/Score.cs | 23 ++++--------------- .../Select/Leaderboards/Leaderboard.cs | 1 + 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index 399a805bcc..15217352d0 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -28,19 +28,8 @@ namespace osu.Game.Rulesets.Scoring public int Combo { get; set; } - private string[] modStrings; [JsonProperty(@"mods")] - protected string[] ModStrings - { - get { return modStrings; } - set - { - modStrings = value; - - if (ruleset != null) - handleModString(); - } - } + protected string[] ModStrings { get; set; } private RulesetInfo ruleset; public RulesetInfo Ruleset @@ -50,8 +39,9 @@ namespace osu.Game.Rulesets.Scoring { ruleset = value; - if (modStrings != null) - handleModString(); + // Handle the mod strings if they are assigned + if (ModStrings != null) + Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => ModStrings.Contains(mod.ShortenedName)).ToArray(); } } @@ -103,10 +93,5 @@ namespace osu.Game.Rulesets.Scoring } public Dictionary Statistics = new Dictionary(); - - private void handleModString() - { - Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray(); - } } } diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 740dc90586..5ec76a59ac 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -55,6 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards i = 0; foreach (var s in scores) { + s.Beatmap = beatmap; s.Ruleset = beatmap?.Ruleset; var ls = new LeaderboardScore(s, 1 + i)