1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 14:02:55 +08:00

Change BeatmapInfo copy logic to be opt-in rather than opt-out

This commit is contained in:
Bartłomiej Dach 2022-02-13 19:04:11 +01:00
parent 13abc392bd
commit 5dabc9282c
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -131,13 +131,28 @@ namespace osu.Game.Beatmaps
else else
{ {
newBeatmap = referenceBeatmap.Clone(); newBeatmap = referenceBeatmap.Clone();
newBeatmap.BeatmapInfo = newBeatmapInfo = referenceBeatmap.BeatmapInfo.Clone();
// assign a new ID to the clone. var referenceBeatmapInfo = referenceBeatmap.BeatmapInfo;
newBeatmapInfo.ID = Guid.NewGuid(); newBeatmap.BeatmapInfo = newBeatmapInfo = new BeatmapInfo(referenceBeatmapInfo.Ruleset, referenceBeatmapInfo.Difficulty.Clone(), referenceBeatmapInfo.Metadata.DeepClone())
// clear difficulty name to avoid clashes on save. {
newBeatmapInfo.DifficultyName = string.Empty; // Only selected appropriate properties are copied over.
// also clear the hash, as that's what is used to match .osu files with their corresponding realm beatmaps. // Things like database ID, online status/ID, MD5 hash, star rating, etc. are omitted
newBeatmapInfo.Hash = string.Empty; // because they should not be copied over and/or they will be recomputed on save.
AudioLeadIn = referenceBeatmapInfo.AudioLeadIn,
StackLeniency = referenceBeatmapInfo.StackLeniency,
SpecialStyle = referenceBeatmapInfo.SpecialStyle,
LetterboxInBreaks = referenceBeatmapInfo.LetterboxInBreaks,
WidescreenStoryboard = referenceBeatmapInfo.WidescreenStoryboard,
EpilepsyWarning = referenceBeatmapInfo.EpilepsyWarning,
SamplesMatchPlaybackRate = referenceBeatmapInfo.SamplesMatchPlaybackRate,
DistanceSpacing = referenceBeatmapInfo.DistanceSpacing,
BeatDivisor = referenceBeatmapInfo.BeatDivisor,
GridSize = referenceBeatmapInfo.GridSize,
TimelineZoom = referenceBeatmapInfo.TimelineZoom,
Countdown = referenceBeatmapInfo.Countdown,
CountdownOffset = referenceBeatmapInfo.CountdownOffset,
Bookmarks = (int[])referenceBeatmapInfo.Bookmarks.Clone()
};
} }
// populate circular beatmap set info <-> beatmap info references manually. // populate circular beatmap set info <-> beatmap info references manually.