1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Use ctor rather than MemberwiseClone to guarantee a safer clone of BeatmapDifficulty

This commit is contained in:
Dean Herbert 2022-01-13 13:23:41 +09:00
parent 86b2ac3217
commit b77cb344d5
2 changed files with 3 additions and 6 deletions

View File

@ -208,6 +208,8 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
#region Overrides of BeatmapDifficulty
public override BeatmapDifficulty Clone() => new TaikoMultiplierAppliedDifficulty(this);
public override void CopyTo(BeatmapDifficulty other)
{
base.CopyTo(other);

View File

@ -37,12 +37,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// Returns a shallow-clone of this <see cref="BeatmapDifficulty"/>.
/// </summary>
public BeatmapDifficulty Clone()
{
var diff = (BeatmapDifficulty)MemberwiseClone();
CopyTo(diff);
return diff;
}
public virtual BeatmapDifficulty Clone() => new BeatmapDifficulty(this);
public virtual void CopyTo(BeatmapDifficulty difficulty)
{