1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 20:45:46 +08:00

Fix bank potentially being overwritten during placement

This commit is contained in:
Dean Herbert 2022-10-19 21:48:18 +09:00
parent 372a655be1
commit b9f41611a7

View File

@ -74,9 +74,13 @@ namespace osu.Game.Rulesets.Edit
/// <param name="commitStart">Whether this call is committing a value for HitObject.StartTime and continuing with further adjustments.</param>
protected void BeginPlacement(bool commitStart = false)
{
// Store and copy the bank, since it is managed by the editor UI.
string bank = HitObject.SampleControlPoint.SampleBank;
var nearestSampleControlPoint = beatmap.HitObjects.LastOrDefault(h => h.GetEndTime() < HitObject.StartTime)?.SampleControlPoint?.DeepClone() as SampleControlPoint;
HitObject.SampleControlPoint = nearestSampleControlPoint ?? new SampleControlPoint();
HitObject.SampleControlPoint.SampleBank = bank;
placementHandler.BeginPlacement(HitObject);
if (commitStart)