1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Improve acceptable difference for repeat edges

Likelihood that `spanDuration` is greater than E+7 is quite low in any realistic case, so this should work fine.
This commit is contained in:
Naxess 2021-06-27 15:39:31 +02:00
parent 1d5bff1660
commit a4a5325b73

View File

@ -98,9 +98,13 @@ namespace osu.Game.Rulesets.Edit.Checks
{
double spanDuration = hasRepeats.Duration / hasRepeats.SpanCount();
double spans = (time - hitObject.StartTime) / spanDuration;
double acceptableDifference = 1 / spanDuration; // 1 ms of acceptable difference, as with head/tail above.
if (Precision.AlmostEquals(spans, Math.Ceiling(spans)) || Precision.AlmostEquals(spans, Math.Floor(spans)))
if (Precision.AlmostEquals(spans, Math.Ceiling(spans), acceptableDifference) ||
Precision.AlmostEquals(spans, Math.Floor(spans), acceptableDifference))
{
return EdgeType.Repeat;
}
}
return EdgeType.None;