1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Fix editor not cloning control points as expected

This commit is contained in:
Dean Herbert 2021-08-30 21:55:08 +09:00
parent 1aaea7011a
commit a2cff75fc0
2 changed files with 7 additions and 2 deletions

View File

@ -91,7 +91,12 @@ namespace osu.Game.Tests.Beatmaps.Formats
// emulate non-legacy control points by cloning the non-legacy portion.
// the assertion is that the encoder can recreate this losslessly from hitobject data.
decoded.beatmap.ControlPointInfo = decoded.beatmap.ControlPointInfo.DeepClone();
var controlPointInfo = new ControlPointInfo();
foreach (var point in decoded.beatmap.ControlPointInfo.AllControlPoints)
controlPointInfo.Add(point.Time, point.DeepClone());
decoded.beatmap.ControlPointInfo = controlPointInfo;
Assert.AreNotEqual(typeof(LegacyControlPointInfo), decoded.beatmap.ControlPointInfo.GetType());

View File

@ -324,7 +324,7 @@ namespace osu.Game.Beatmaps.ControlPoints
public ControlPointInfo DeepClone()
{
var controlPointInfo = new ControlPointInfo();
var controlPointInfo = (ControlPointInfo)Activator.CreateInstance(GetType());
foreach (var point in AllControlPoints)
controlPointInfo.Add(point.Time, point.DeepClone());