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

Fix incremental unstable rate calculation not matching expectations

The `EventCount` variable wasn't factoring in that some results do not
affect unstable rate. It would therefore become more incorrect as the
play continued.

Closes https://github.com/ppy/osu/issues/31712.
This commit is contained in:
Dean Herbert 2025-01-29 17:06:13 +09:00
parent 6c4b4166ac
commit d8ec3b77e4
No known key found for this signature in database

View File

@ -28,11 +28,12 @@ namespace osu.Game.Rulesets.Scoring
result ??= new UnstableRateCalculationResult();
// Handle rewinding in the simplest way possible.
if (hitEvents.Count < result.EventCount + 1)
if (hitEvents.Count < result.LastProcessedIndex + 1)
result = new UnstableRateCalculationResult();
for (int i = result.EventCount; i < hitEvents.Count; i++)
for (int i = result.LastProcessedIndex + 1; i < hitEvents.Count; i++)
{
result.LastProcessedIndex = i;
HitEvent e = hitEvents[i];
if (!AffectsUnstableRate(e))
@ -84,6 +85,11 @@ namespace osu.Game.Rulesets.Scoring
/// </remarks>
public class UnstableRateCalculationResult
{
/// <summary>
/// The last result index processed. For internal incremental calculation use.
/// </summary>
public int LastProcessedIndex = -1;
/// <summary>
/// Total events processed. For internal incremental calculation use.
/// </summary>