1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 07:07:45 +08:00

Fix wrong mono streak length handling in corner case

This commit is contained in:
Bartłomiej Dach 2020-09-10 19:21:16 +02:00
parent 6e5c5ab901
commit a350802158
3 changed files with 36 additions and 1 deletions

View File

@ -45,7 +45,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
// hits spaced more than a second apart are also exempt from colour strain.
if (!(current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000))
{
previousHitType = null;
monoHistory.Clear();
var currentHit = current.BaseObject as Hit;
currentMonoLength = currentHit != null ? 1 : 0;
previousHitType = currentHit?.Type;
return 0.0;
}

View File

@ -94,5 +94,26 @@ namespace osu.Game.Tests.NonVisual
Assert.Throws<InvalidOperationException>(() => queue.Dequeue());
}
[Test]
public void TestClearQueue()
{
queue.Enqueue(3);
queue.Enqueue(5);
Assert.AreEqual(2, queue.Count);
queue.Clear();
Assert.AreEqual(0, queue.Count);
Assert.Throws<ArgumentOutOfRangeException>(() => _ = queue[0]);
queue.Enqueue(7);
Assert.AreEqual(1, queue.Count);
Assert.AreEqual(7, queue[0]);
Assert.Throws<ArgumentOutOfRangeException>(() => _ = queue[1]);
queue.Enqueue(9);
Assert.AreEqual(2, queue.Count);
Assert.AreEqual(9, queue[1]);
}
}
}

View File

@ -40,8 +40,17 @@ namespace osu.Game.Rulesets.Difficulty.Utils
this.capacity = capacity;
array = new T[capacity];
Clear();
}
/// <summary>
/// Removes all elements from the <see cref="LimitedCapacityQueue{T}"/>.
/// </summary>
public void Clear()
{
start = 0;
end = -1;
Count = 0;
}
/// <summary>