From 5137338c7c97890d39dcb777ac309e6de83a2b6c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 16 Mar 2017 17:11:24 +0900 Subject: [PATCH 1/3] Replace List with TimingInfo in Beatmap. --- osu.Game.Modes.Osu/Objects/Slider.cs | 2 +- osu.Game/Beatmaps/Beatmap.cs | 66 +++++------ osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 2 - osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Beatmaps/Timing/TimingInfo.cs | 106 ++++++++++++++++++ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 6 +- osu.Game/osu.Game.csproj | 1 + 7 files changed, 140 insertions(+), 45 deletions(-) create mode 100644 osu.Game/Beatmaps/Timing/TimingInfo.cs diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 83a5a458c7..6c00af89b3 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -54,7 +54,7 @@ namespace osu.Game.Modes.Osu.Objects var baseDifficulty = beatmap.BeatmapInfo.BaseDifficulty; ControlPoint overridePoint; - ControlPoint timingPoint = beatmap.TimingPointAt(StartTime, out overridePoint); + ControlPoint timingPoint = beatmap.TimingInfo.TimingPointAt(StartTime, out overridePoint); var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1; var baseVelocity = 100 * baseDifficulty.SliderMultiplier / velocityAdjustment; diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 6dbd605359..bf86aeea83 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -7,7 +7,6 @@ using osu.Game.Database; using osu.Game.Modes; using osu.Game.Modes.Objects; using System.Collections.Generic; -using System.Linq; namespace osu.Game.Beatmaps { @@ -18,7 +17,7 @@ namespace osu.Game.Beatmaps where T : HitObject { public BeatmapInfo BeatmapInfo; - public List ControlPoints; + public TimingInfo TimingInfo = new TimingInfo(); public readonly List ComboColors = new List { new Color4(17, 136, 170, 255), @@ -41,49 +40,40 @@ namespace osu.Game.Beatmaps public Beatmap(Beatmap original = null) { BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo; - ControlPoints = original?.ControlPoints ?? ControlPoints; + TimingInfo = original?.TimingInfo ?? TimingInfo; ComboColors = original?.ComboColors ?? ComboColors; } - public double BPMMaximum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength; - public double BPMMinimum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength; - public double BPMMode => BPMAt(ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); - - public double BPMAt(double time) + /// + /// Finds the slider velocity at a time. + /// + /// The time to find the slider velocity at. + /// The slider velocity in positional length units. + public double SliderVelocityAt(double time) { - return 60000 / BeatLengthAt(time); + double scoringDistance = 100 * BeatmapInfo.BaseDifficulty.SliderMultiplier; + double beatDistance = TimingInfo.BeatDistanceAt(time); + + if (beatDistance > 0) + return scoringDistance / beatDistance * 1000; + return scoringDistance; } - public double BeatLengthAt(double time) + /// + /// Maps a difficulty value [0, 10] to a two-piece linear range of values. + /// + /// The difficulty value to be mapped. + /// Minimum of the resulting range which will be achieved by a difficulty value of 0. + /// Midpoint of the resulting range which will be achieved by a difficulty value of 5. + /// Maximum of the resulting range which will be achieved by a difficulty value of 10. + /// Value to which the difficulty value maps in the specified range. + public static double MapDifficultyRange(double difficulty, double min, double mid, double max) { - ControlPoint overridePoint; - ControlPoint timingPoint = TimingPointAt(time, out overridePoint); - return timingPoint.BeatLength; - } - - public ControlPoint TimingPointAt(double time, out ControlPoint overridePoint) - { - overridePoint = null; - - ControlPoint timingPoint = null; - foreach (var controlPoint in ControlPoints) - { - // Some beatmaps have the first timingPoint (accidentally) start after the first HitObject(s). - // This null check makes it so that the first ControlPoint that makes a timing change is used as - // the timingPoint for those HitObject(s). - if (controlPoint.Time <= time || timingPoint == null) - { - if (controlPoint.TimingChange) - { - timingPoint = controlPoint; - overridePoint = null; - } - else overridePoint = controlPoint; - } - else break; - } - - return timingPoint ?? ControlPoint.Default; + if (difficulty > 5) + return mid + (max - mid) * (difficulty - 5) / 5; + if (difficulty < 5) + return mid - (mid - min) * (5 - difficulty) / 5; + return mid; } } diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index ba608fb08d..88cc977f1d 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using osu.Game.Modes.Objects; -using osu.Game.Beatmaps.Timing; using osu.Game.Database; namespace osu.Game.Beatmaps.Formats @@ -43,7 +42,6 @@ namespace osu.Game.Beatmaps.Formats var beatmap = new Beatmap { HitObjects = new List(), - ControlPoints = new List(), BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata(), diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 71d26b2c51..86f75de794 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -209,7 +209,7 @@ namespace osu.Game.Beatmaps.Formats } if (cp != null) - beatmap.ControlPoints.Add(cp); + beatmap.TimingInfo.ControlPoints.Add(cp); } private void handleColours(Beatmap beatmap, string key, string val, ref bool hasCustomColours) diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs new file mode 100644 index 0000000000..f245a6b1aa --- /dev/null +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -0,0 +1,106 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Beatmaps.Timing +{ + public class TimingInfo + { + public readonly List ControlPoints = new List(); + + public double BPMMaximum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength; + public double BPMMinimum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength; + public double BPMMode => BPMAt(ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); + + public double BPMAt(double time) + { + return 60000 / BeatLengthAt(time); + } + + /// + /// Finds the BPM multiplier at a time. + /// + /// The time to find the BPM multiplier at. + /// The BPM multiplier. + public double BPMMultiplierAt(double time) + { + ControlPoint overridePoint; + ControlPoint timingPoint = TimingPointAt(time, out overridePoint); + + return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1; + } + + /// + /// Finds the beat length at a time. + /// + /// The time to find the beat length at. + /// The beat length in milliseconds. + public double BeatLengthAt(double time) + { + ControlPoint overridePoint; + ControlPoint timingPoint = TimingPointAt(time, out overridePoint); + + return timingPoint.BeatLength; + } + + /// + /// Finds the beat velocity at a time. + /// + /// The time to find the velocity at. + /// The velocity. + public double BeatVelocityAt(double time) + { + ControlPoint overridePoint; + ControlPoint timingPoint = TimingPointAt(time, out overridePoint); + + return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1; + } + + /// + /// Finds the beat length at a time. + /// + /// The time to find the beat length at. + /// The beat length in positional length units. + public double BeatDistanceAt(double time) + { + ControlPoint overridePoint; + ControlPoint timingPoint = TimingPointAt(time, out overridePoint); + + return (timingPoint?.BeatLength ?? 1) * (overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1); + } + + /// + /// Finds the timing point at a time. + /// + /// The time to find the timing point at. + /// The timing point containing the velocity change of the returned timing point. + /// The timing point. + public ControlPoint TimingPointAt(double time, out ControlPoint overridePoint) + { + overridePoint = null; + + ControlPoint timingPoint = null; + foreach (var controlPoint in ControlPoints) + { + // Some beatmaps have the first timingPoint (accidentally) start after the first HitObject(s). + // This null check makes it so that the first ControlPoint that makes a timing change is used as + // the timingPoint for those HitObject(s). + if (controlPoint.Time <= time || timingPoint == null) + { + if (controlPoint.TimingChange) + { + timingPoint = controlPoint; + overridePoint = null; + } + else + overridePoint = controlPoint; + } + else break; + } + + return timingPoint ?? ControlPoint.Default; + } + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index f82c35598a..5285d26264 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -217,12 +217,12 @@ namespace osu.Game.Screens.Select private string getBPMRange(Beatmap beatmap) { - double bpmMax = beatmap.BPMMaximum; - double bpmMin = beatmap.BPMMinimum; + double bpmMax = beatmap.TimingInfo.BPMMaximum; + double bpmMin = beatmap.TimingInfo.BPMMinimum; if (Precision.AlmostEquals(bpmMin, bpmMax)) return Math.Round(bpmMin) + "bpm"; - return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (mostly " + Math.Round(beatmap.BPMMode) + "bpm)"; + return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (mostly " + Math.Round(beatmap.TimingInfo.BPMMode) + "bpm)"; } public class InfoLabel : Container diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3ec8b535c7..285937003a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -75,6 +75,7 @@ + From 28e006eeb9f806e8cc41653df295fef4f17ac3ac Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 16 Mar 2017 23:17:27 +0900 Subject: [PATCH 2/3] Move MapDifficultyRange into BaseDifficulty. --- osu.Game/Database/BaseDifficulty.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/osu.Game/Database/BaseDifficulty.cs b/osu.Game/Database/BaseDifficulty.cs index 83f6e2fdd5..ea7511315f 100644 --- a/osu.Game/Database/BaseDifficulty.cs +++ b/osu.Game/Database/BaseDifficulty.cs @@ -15,6 +15,23 @@ namespace osu.Game.Database public float ApproachRate { get; set; } public float SliderMultiplier { get; set; } public float SliderTickRate { get; set; } + + /// + /// Maps a difficulty value [0, 10] to a two-piece linear range of values. + /// + /// The difficulty value to be mapped. + /// Minimum of the resulting range which will be achieved by a difficulty value of 0. + /// Midpoint of the resulting range which will be achieved by a difficulty value of 5. + /// Maximum of the resulting range which will be achieved by a difficulty value of 10. + /// Value to which the difficulty value maps in the specified range. + public static double DifficultyRange(double difficulty, double min, double mid, double max) + { + if (difficulty > 5) + return mid + (max - mid) * (difficulty - 5) / 5; + if (difficulty < 5) + return mid - (mid - min) * (5 - difficulty) / 5; + return mid; + } } } From e0a8c3b1e566e182db06fbd5e7fc78e206f8a492 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 16 Mar 2017 23:18:02 +0900 Subject: [PATCH 3/3] Rename BaseDifficulty -> Difficulty / BeatmapDifficulty. --- .../Tests/TestCaseGamefield.cs | 2 +- .../Tests/TestCasePlaySongSelect.cs | 6 +++--- .../Tests/TestCasePlayer.cs | 2 +- osu.Game.Modes.Osu/Objects/OsuHitObject.cs | 2 +- osu.Game.Modes.Osu/Objects/Slider.cs | 2 +- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 2 +- osu.Game/Beatmaps/Beatmap.cs | 19 +------------------ osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 2 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Database/BaseDifficulty.cs | 2 +- osu.Game/Database/BeatmapDatabase.cs | 8 ++++---- osu.Game/Database/BeatmapInfo.cs | 6 +++--- 12 files changed, 19 insertions(+), 36 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index aff2903078..c2e33f7f32 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -48,7 +48,7 @@ namespace osu.Desktop.VisualTests.Tests HitObjects = objects, BeatmapInfo = new BeatmapInfo { - BaseDifficulty = new BaseDifficulty(), + Difficulty = new BeatmapDifficulty(), Metadata = new BeatmapMetadata { Artist = @"Unknown", diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index a4995d2320..c97ea929f3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -80,7 +80,7 @@ namespace osu.Desktop.VisualTests.Tests Mode = PlayMode.Osu, Path = "normal.osu", Version = "Normal", - BaseDifficulty = new BaseDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 3.5f, } @@ -91,7 +91,7 @@ namespace osu.Desktop.VisualTests.Tests Mode = PlayMode.Osu, Path = "hard.osu", Version = "Hard", - BaseDifficulty = new BaseDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 5, } @@ -102,7 +102,7 @@ namespace osu.Desktop.VisualTests.Tests Mode = PlayMode.Osu, Path = "insane.osu", Version = "Insane", - BaseDifficulty = new BaseDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 7, } diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 0d32532f09..41bd24b900 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -65,7 +65,7 @@ namespace osu.Desktop.VisualTests.Tests HitObjects = objects, BeatmapInfo = new BeatmapInfo { - BaseDifficulty = new BaseDifficulty(), + Difficulty = new BeatmapDifficulty(), Metadata = new BeatmapMetadata { Artist = @"Unknown", diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index a3f2222fbb..cee55a281c 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -69,7 +69,7 @@ namespace osu.Game.Modes.Osu.Objects public virtual void SetDefaultsFromBeatmap(Beatmap beatmap) { - Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2; + Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.Difficulty.CircleSize - 5) / 5) / 2; } } } diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 6c00af89b3..fdf3658d44 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -51,7 +51,7 @@ namespace osu.Game.Modes.Osu.Objects { base.SetDefaultsFromBeatmap(beatmap); - var baseDifficulty = beatmap.BeatmapInfo.BaseDifficulty; + var baseDifficulty = beatmap.BeatmapInfo.Difficulty; ControlPoint overridePoint; ControlPoint timingPoint = beatmap.TimingInfo.TimingPointAt(StartTime, out overridePoint); diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 61638ef25e..356fa5a6c1 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -94,7 +94,7 @@ namespace osu.Game.Tests.Beatmaps.Formats using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) { var beatmap = decoder.Decode(new StreamReader(stream)); - var difficulty = beatmap.BeatmapInfo.BaseDifficulty; + var difficulty = beatmap.BeatmapInfo.Difficulty; Assert.AreEqual(6.5f, difficulty.DrainRate); Assert.AreEqual(4, difficulty.CircleSize); Assert.AreEqual(8, difficulty.OverallDifficulty); diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index bf86aeea83..fc8bb751f9 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -51,30 +51,13 @@ namespace osu.Game.Beatmaps /// The slider velocity in positional length units. public double SliderVelocityAt(double time) { - double scoringDistance = 100 * BeatmapInfo.BaseDifficulty.SliderMultiplier; + double scoringDistance = 100 * BeatmapInfo.Difficulty.SliderMultiplier; double beatDistance = TimingInfo.BeatDistanceAt(time); if (beatDistance > 0) return scoringDistance / beatDistance * 1000; return scoringDistance; } - - /// - /// Maps a difficulty value [0, 10] to a two-piece linear range of values. - /// - /// The difficulty value to be mapped. - /// Minimum of the resulting range which will be achieved by a difficulty value of 0. - /// Midpoint of the resulting range which will be achieved by a difficulty value of 5. - /// Maximum of the resulting range which will be achieved by a difficulty value of 10. - /// Value to which the difficulty value maps in the specified range. - public static double MapDifficultyRange(double difficulty, double min, double mid, double max) - { - if (difficulty > 5) - return mid + (max - mid) * (difficulty - 5) / 5; - if (difficulty < 5) - return mid - (mid - min) * (5 - difficulty) / 5; - return mid; - } } /// diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 88cc977f1d..425c6cc5dc 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps.Formats BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata(), - BaseDifficulty = new BaseDifficulty(), + Difficulty = new BeatmapDifficulty(), }, }; ParseFile(stream, beatmap); diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 86f75de794..e7ede36b4b 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -144,7 +144,7 @@ namespace osu.Game.Beatmaps.Formats private void handleDifficulty(Beatmap beatmap, string key, string val) { - var difficulty = beatmap.BeatmapInfo.BaseDifficulty; + var difficulty = beatmap.BeatmapInfo.Difficulty; switch (key) { case @"HPDrainRate": diff --git a/osu.Game/Database/BaseDifficulty.cs b/osu.Game/Database/BaseDifficulty.cs index ea7511315f..3db8b29644 100644 --- a/osu.Game/Database/BaseDifficulty.cs +++ b/osu.Game/Database/BaseDifficulty.cs @@ -5,7 +5,7 @@ using SQLite.Net.Attributes; namespace osu.Game.Database { - public class BaseDifficulty + public class BeatmapDifficulty { [PrimaryKey, AutoIncrement] public int ID { get; set; } diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 871251b882..b3d48c152f 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -64,7 +64,7 @@ namespace osu.Game.Database foreach (var i in b.Beatmaps) { if (i.Metadata != null) connection.Delete(i.Metadata); - if (i.BaseDifficulty != null) connection.Delete(i.BaseDifficulty); + if (i.Difficulty != null) connection.Delete(i.Difficulty); connection.Delete(i); } @@ -90,7 +90,7 @@ namespace osu.Game.Database try { conn.CreateTable(); - conn.CreateTable(); + conn.CreateTable(); conn.CreateTable(); conn.CreateTable(); } @@ -112,7 +112,7 @@ namespace osu.Game.Database } connection.DeleteAll(); - connection.DeleteAll(); + connection.DeleteAll(); connection.DeleteAll(); connection.DeleteAll(); } @@ -329,7 +329,7 @@ namespace osu.Game.Database typeof(BeatmapSetInfo), typeof(BeatmapInfo), typeof(BeatmapMetadata), - typeof(BaseDifficulty), + typeof(BeatmapDifficulty), }; public void Update(T record, bool cascade = true) where T : class diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 017f34726b..5f9c0baee8 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -31,11 +31,11 @@ namespace osu.Game.Database [OneToOne(CascadeOperations = CascadeOperation.All)] public BeatmapMetadata Metadata { get; set; } - [ForeignKey(typeof(BaseDifficulty)), NotNull] + [ForeignKey(typeof(BeatmapDifficulty)), NotNull] public int BaseDifficultyID { get; set; } [OneToOne(CascadeOperations = CascadeOperation.All)] - public BaseDifficulty BaseDifficulty { get; set; } + public BeatmapDifficulty Difficulty { get; set; } public string Path { get; set; } @@ -80,7 +80,7 @@ namespace osu.Game.Database { get { - return starDifficulty < 0 ? (BaseDifficulty?.OverallDifficulty ?? 5) : starDifficulty; + return starDifficulty < 0 ? (Difficulty?.OverallDifficulty ?? 5) : starDifficulty; } set { starDifficulty = value; }