Fix undo/redo behaving poorly with simultaneous objects

This commit is contained in:
smoogipoo
2020-04-30 20:39:41 +09:00
parent 1cb3f39f60
commit c96bc5c51c
3 changed files with 45 additions and 6 deletions

View File

@ -63,8 +63,10 @@ namespace osu.Game.Screens.Edit
}
}
// Make the removal indices are sorted so that iteration order doesn't get messed up post-removal.
// Sort the indices to ensure that removal + insertion indices don't get jumbled up post-removal or post-insertion.
// This isn't strictly required, but the differ makes no guarantees about order.
toRemove.Sort();
toAdd.Sort();
// Apply the changes.
for (int i = toRemove.Count - 1; i >= 0; i--)
@ -74,7 +76,7 @@ namespace osu.Game.Screens.Edit
{
IBeatmap newBeatmap = readBeatmap(newState);
foreach (var i in toAdd)
editorBeatmap.Add(newBeatmap.HitObjects[i]);
editorBeatmap.Insert(i, newBeatmap.HitObjects[i]);
}
}