From dcd69e852eb0a516fc4d7bdfe27b23503f5d66b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Dec 2021 16:30:34 +0900 Subject: [PATCH] Add back settable `RulesetID` for now --- osu.Game/Beatmaps/BeatmapInfo.cs | 15 ++++++++++++++- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 4 +--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 16133ae362..ea2508032e 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -140,8 +140,21 @@ namespace osu.Game.Beatmaps #region Compatibility properties + private int rulesetID; + [Ignored] - public int RulesetID => Ruleset.OnlineID; + public int RulesetID + { + // ReSharper disable once ConstantConditionalAccessQualifier + get => Ruleset?.OnlineID ?? rulesetID; + set + { + if (Ruleset != null) + throw new InvalidOperationException($"Cannot set a {nameof(RulesetID)} when {nameof(Ruleset)} is non-null"); + + rulesetID = value; + } + } [Ignored] public Guid BeatmapSetInfoID => BeatmapSet?.ID ?? Guid.Empty; diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 5c61d302c2..e5db9d045a 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -11,7 +11,6 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Timing; using osu.Game.IO; -using osu.Game.Rulesets; using osu.Game.Rulesets.Objects.Legacy; namespace osu.Game.Beatmaps.Formats @@ -142,8 +141,7 @@ namespace osu.Game.Beatmaps.Formats break; case @"Mode": - // TODO: ha ha ha. - beatmap.BeatmapInfo.Ruleset = new RulesetInfo(Parsing.ParseInt(pair.Value), "some ruleset", "wangs", true /* probably not */); + beatmap.BeatmapInfo.RulesetID = Parsing.ParseInt(pair.Value); switch (beatmap.BeatmapInfo.RulesetID) {