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

Fix mania notelock crashing with overlapping hitwindows

This commit is contained in:
smoogipoo 2020-11-11 12:37:00 +09:00
parent e44a8b3934
commit 44aed19e4e
4 changed files with 26 additions and 3 deletions

View File

@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Mania.Tests
assertHeadJudgement(HitResult.Miss); assertHeadJudgement(HitResult.Miss);
assertTickJudgement(HitResult.LargeTickMiss); assertTickJudgement(HitResult.LargeTickMiss);
assertTailJudgement(HitResult.Miss); assertTailJudgement(HitResult.Miss);
assertNoteJudgement(HitResult.IgnoreHit); assertNoteJudgement(HitResult.IgnoreMiss);
} }
/// <summary> /// <summary>

View File

@ -54,6 +54,29 @@ namespace osu.Game.Rulesets.Mania.Tests
} }
} }
[Test]
public void TestMissAfterNextObjectStartTime()
{
var objects = new List<ManiaHitObject>
{
new HoldNote
{
StartTime = 1000,
EndTime = 1200,
},
new HoldNote
{
StartTime = 1220,
EndTime = 1420
}
};
performTest(objects, new List<ReplayFrame>());
addJudgementAssert(objects[0], HitResult.IgnoreMiss);
addJudgementAssert(objects[1], HitResult.IgnoreMiss);
}
private void addJudgementAssert(ManiaHitObject hitObject, HitResult result) private void addJudgementAssert(ManiaHitObject hitObject, HitResult result)
{ {
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judgement is {result}", AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judgement is {result}",

View File

@ -233,7 +233,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
if (Tail.AllJudged) if (Tail.AllJudged)
{ {
ApplyResult(r => r.Type = r.Judgement.MaxResult); ApplyResult(r => r.Type = Tail.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
endHold(); endHold();
} }

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Mania.UI
/// <param name="hitObject">The <see cref="HitObject"/> that was hit.</param> /// <param name="hitObject">The <see cref="HitObject"/> that was hit.</param>
public void HandleHit(DrawableHitObject hitObject) public void HandleHit(DrawableHitObject hitObject)
{ {
if (!IsHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset)) if (hitObject.IsHit && !IsHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset))
throw new InvalidOperationException($"A {hitObject} was hit before it became hittable!"); throw new InvalidOperationException($"A {hitObject} was hit before it became hittable!");
foreach (var obj in enumerateHitObjectsUpTo(hitObject.HitObject.StartTime)) foreach (var obj in enumerateHitObjectsUpTo(hitObject.HitObject.StartTime))