diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index 0d1dc21e96..9ff54a4573 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -5,7 +5,7 @@ using System; namespace osu.Game.Beatmaps.ControlPoints { - public class ControlPoint : IComparable + public class ControlPoint : IComparable, IEquatable { /// /// The time at which the control point takes effect. @@ -13,5 +13,12 @@ namespace osu.Game.Beatmaps.ControlPoints public double Time; public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time); + + public bool Equals(ControlPoint other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Time.Equals(other.Time); + } } } diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 5d8a5753b0..f261589955 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -35,10 +35,12 @@ namespace osu.Game.Graphics.Containers protected override void Update() { - if (Beatmap.Value?.Track == null) + var track = Beatmap.Value?.Track; + + if (track == null) return; - double currentTrackTime = Beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds; + double currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime; TimingControlPoint timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); EffectControlPoint effectPoint = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); @@ -58,7 +60,7 @@ namespace osu.Game.Graphics.Containers TimeSinceLastBeat = timingPoint.BeatLength - TimeUntilNextBeat; - if (timingPoint == lastTimingPoint && beatIndex == lastBeat) + if (timingPoint.Equals(lastTimingPoint) && beatIndex == lastBeat) return; using (BeginDelayedSequence(-TimeSinceLastBeat, true))