mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 20:22:56 +08:00
Merge pull request #31723 from peppy/fix-unstable-rate-incrementatl
Fix incremental unstable rate calculation not matching expectations
This commit is contained in:
commit
007bf87a6b
@ -36,6 +36,10 @@ namespace osu.Game.Tests.NonVisual.Ranking
|
||||
.Select(t => new HitEvent(t - 5, 1.0, HitResult.Great, new HitObject(), null, null))
|
||||
.ToList();
|
||||
|
||||
// Add some red herrings
|
||||
events.Insert(4, new HitEvent(200, 1.0, HitResult.Meh, new HitObject { HitWindows = HitWindows.Empty }, null, null));
|
||||
events.Insert(8, new HitEvent(-100, 1.0, HitResult.Miss, new HitObject(), null, null));
|
||||
|
||||
HitEventExtensions.UnstableRateCalculationResult result = null;
|
||||
|
||||
for (int i = 0; i < events.Count; i++)
|
||||
@ -57,6 +61,10 @@ namespace osu.Game.Tests.NonVisual.Ranking
|
||||
.Select(t => new HitEvent(t - 5, 1.0, HitResult.Great, new HitObject(), null, null))
|
||||
.ToList();
|
||||
|
||||
// Add some red herrings
|
||||
events.Insert(4, new HitEvent(200, 1.0, HitResult.Meh, new HitObject { HitWindows = HitWindows.Empty }, null, null));
|
||||
events.Insert(8, new HitEvent(-100, 1.0, HitResult.Miss, new HitObject(), null, null));
|
||||
|
||||
HitEventExtensions.UnstableRateCalculationResult result = null;
|
||||
|
||||
for (int i = 0; i < events.Count; i++)
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user