From e666a82e1f01a6b6fc891b7c8b52660752d67cf8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 19 Apr 2018 18:50:21 +0900 Subject: [PATCH] Fix cloning --- osu.Game/Beatmaps/Beatmap.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 541f7f85b6..7066432c5c 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -90,19 +90,19 @@ namespace osu.Game.Beatmaps IEnumerable IBeatmap.HitObjects => HitObjects; - public Beatmap Clone() => new Beatmap - { - BeatmapInfo = BeatmapInfo.DeepClone(), - ControlPointInfo = ControlPointInfo, - Breaks = Breaks, - HitObjects = HitObjects - }; - IBeatmap IBeatmap.Clone() => Clone(); + + public Beatmap Clone() + { + var newInstance = (Beatmap)MemberwiseClone(); + newInstance.BeatmapInfo = BeatmapInfo.DeepClone(); + + return newInstance; + } } public class Beatmap : Beatmap { - public new Beatmap Clone() => (Beatmap)base.Clone(); + public Beatmap Clone() => (Beatmap)base.Clone(); } }