1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 21:13:21 +08:00

Encapsulate Track inside a FramedClock to avoid mutating operations

This commit is contained in:
Dean Herbert 2022-08-29 16:29:19 +09:00
parent c50695ea49
commit be5c6232e8

View File

@ -381,7 +381,16 @@ namespace osu.Game
Beatmap.BindValueChanged(onBeatmapChanged);
}
private void onTrackChanged(WorkingBeatmap beatmap, TrackChangeDirection direction) => beatmapClock.ChangeSource(beatmap.Track);
private void onTrackChanged(WorkingBeatmap beatmap, TrackChangeDirection direction)
{
// FramedBeatmapClock uses a decoupled clock internally which will mutate the source if it is an `IAdjustableClock`.
// We don't want this for now, as the intention of beatmapClock is to be a read-only source for beat sync components.
//
// Encapsulating in a FramedClock will avoid any mutations.
var framedClock = new FramedClock(beatmap.Track);
beatmapClock.ChangeSource(framedClock);
}
protected virtual void InitialiseFonts()
{