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

Remove manual breaks at the start/end of beatmap

This is the secondary cause of https://github.com/ppy/osu/issues/28577,
because you could do the following:

- Have a break autogenerate itself
- Adjust either end of it to make it mark itself as manually-adjusted
- Remove all objects before or after said break

to end up in a state wherein there are no objects before or after a
break.

The direct fix is still correct because it is still technically possible
to end up in a state wherein a break is before or after all objects
(obvious one is manual `.osu` editing), but this behaviour is also
undesirable for the autogeneration logic.
This commit is contained in:
Bartłomiej Dach 2024-06-25 12:48:54 +02:00
parent 18e2a925a8
commit fae6dcfffa
No known key found for this signature in database

View File

@ -40,9 +40,13 @@ namespace osu.Game.Screens.Edit
foreach (var manualBreak in Beatmap.Breaks.ToList()) foreach (var manualBreak in Beatmap.Breaks.ToList())
{ {
if (Beatmap.HitObjects.Any(ho => ho.StartTime <= manualBreak.EndTime && ho.GetEndTime() >= manualBreak.StartTime)) if (manualBreak.EndTime <= Beatmap.HitObjects.FirstOrDefault()?.StartTime
|| manualBreak.StartTime >= Beatmap.HitObjects.LastOrDefault()?.GetEndTime()
|| Beatmap.HitObjects.Any(ho => ho.StartTime <= manualBreak.EndTime && ho.GetEndTime() >= manualBreak.StartTime))
{
Beatmap.Breaks.Remove(manualBreak); Beatmap.Breaks.Remove(manualBreak);
} }
}
for (int i = 1; i < Beatmap.HitObjects.Count; ++i) for (int i = 1; i < Beatmap.HitObjects.Count; ++i)
{ {