Merge pull request #11503 from peppy/revert-beatmap-controlpointinfo-cloning

Revert forced cloning of ControlPointInfo
This commit is contained in:
Dan Balasescu
2021-01-25 21:14:21 +09:00
committed by GitHub
5 changed files with 16 additions and 12 deletions

View File

@ -50,15 +50,7 @@ namespace osu.Game.Beatmaps
IBeatmap IBeatmap.Clone() => Clone(); IBeatmap IBeatmap.Clone() => Clone();
public Beatmap<T> Clone() public Beatmap<T> Clone() => (Beatmap<T>)MemberwiseClone();
{
var clone = (Beatmap<T>)MemberwiseClone();
clone.ControlPointInfo = ControlPointInfo.CreateCopy();
// todo: deep clone other elements as required.
return clone;
}
} }
public class Beatmap : Beatmap<HitObject> public class Beatmap : Beatmap<HitObject>

View File

@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps
/// <summary> /// <summary>
/// The control points in this beatmap. /// The control points in this beatmap.
/// </summary> /// </summary>
ControlPointInfo ControlPointInfo { get; } ControlPointInfo ControlPointInfo { get; set; }
/// <summary> /// <summary>
/// The breaks in this beatmap. /// The breaks in this beatmap.

View File

@ -131,6 +131,10 @@ namespace osu.Game.Screens.Edit
try try
{ {
playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset); playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
// clone these locally for now to avoid incurring overhead on GetPlayableBeatmap usages.
// eventually we will want to improve how/where this is done as there are issues with *not* cloning it in all cases.
playableBeatmap.ControlPointInfo = playableBeatmap.ControlPointInfo.CreateCopy();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -74,7 +74,11 @@ namespace osu.Game.Screens.Edit
public BeatmapMetadata Metadata => PlayableBeatmap.Metadata; public BeatmapMetadata Metadata => PlayableBeatmap.Metadata;
public ControlPointInfo ControlPointInfo => PlayableBeatmap.ControlPointInfo; public ControlPointInfo ControlPointInfo
{
get => PlayableBeatmap.ControlPointInfo;
set => PlayableBeatmap.ControlPointInfo = value;
}
public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks; public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks;

View File

@ -29,7 +29,11 @@ namespace osu.Game.Screens.Play
public BeatmapMetadata Metadata => PlayableBeatmap.Metadata; public BeatmapMetadata Metadata => PlayableBeatmap.Metadata;
public ControlPointInfo ControlPointInfo => PlayableBeatmap.ControlPointInfo; public ControlPointInfo ControlPointInfo
{
get => PlayableBeatmap.ControlPointInfo;
set => PlayableBeatmap.ControlPointInfo = value;
}
public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks; public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks;