mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 15:27:30 +08:00
Fix wrong mono streak length handling in corner case
This commit is contained in:
parent
6e5c5ab901
commit
a350802158
@ -45,7 +45,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
// hits spaced more than a second apart are also exempt from colour strain.
|
// 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))
|
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;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,5 +94,26 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
|
|
||||||
Assert.Throws<InvalidOperationException>(() => queue.Dequeue());
|
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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,17 @@ namespace osu.Game.Rulesets.Difficulty.Utils
|
|||||||
|
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
array = new T[capacity];
|
array = new T[capacity];
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all elements from the <see cref="LimitedCapacityQueue{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
start = 0;
|
start = 0;
|
||||||
end = -1;
|
end = -1;
|
||||||
|
Count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user