From 28375ed1fcf62d69ef1b2e4231d5e583005327ea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Apr 2017 15:03:07 +0900 Subject: [PATCH] Allow transfer of previously loaded background between WorkingBeatmaps --- osu.Game/Beatmaps/WorkingBeatmap.cs | 3 +++ osu.Game/Database/BeatmapInfo.cs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 616128dab5..589557b088 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -94,6 +94,9 @@ namespace osu.Game.Beatmaps { if (track != null && BeatmapInfo.AudioEquals(other.BeatmapInfo)) other.track = track; + + if (background != null && BeatmapInfo.BackgroundEquals(other.BeatmapInfo)) + other.background = background; } public virtual void Dispose() diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 5097622deb..c2e35d64a8 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -93,5 +93,9 @@ namespace osu.Game.Database public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && BeatmapSet.Path == other.BeatmapSet.Path && (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; + + public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && + BeatmapSet.Path == other.BeatmapSet.Path && + (Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile; } }