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

Fix osu!mania scores failing to convert to new standardised score due to cast failure

Regressed in https://github.com/ppy/osu/pull/23917.
Closes #24217.
This commit is contained in:
Dean Herbert 2023-07-14 19:29:36 +09:00
parent cdbb6f90be
commit d4fb0bef95

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
}
protected override IEnumerable<HitObject> EnumerateHitObjects(IBeatmap beatmap)
=> base.EnumerateHitObjects(beatmap).OrderBy(ho => (ManiaHitObject)ho, JudgementOrderComparer.DEFAULT);
=> base.EnumerateHitObjects(beatmap).OrderBy(ho => ho, JudgementOrderComparer.DEFAULT);
protected override double ComputeTotalScore(double comboProgress, double accuracyProgress, double bonusPortion)
{
@ -34,11 +34,11 @@ namespace osu.Game.Rulesets.Mania.Scoring
protected override double GetComboScoreChange(JudgementResult result)
=> Judgement.ToNumericResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base));
private class JudgementOrderComparer : IComparer<ManiaHitObject>
private class JudgementOrderComparer : IComparer<HitObject>
{
public static readonly JudgementOrderComparer DEFAULT = new JudgementOrderComparer();
public int Compare(ManiaHitObject? x, ManiaHitObject? y)
public int Compare(HitObject? x, HitObject? y)
{
if (ReferenceEquals(x, y)) return 0;
if (ReferenceEquals(x, null)) return -1;
@ -48,11 +48,14 @@ namespace osu.Game.Rulesets.Mania.Scoring
if (result != 0)
return result;
// due to the way input is handled in mania, notes take precedence over ticks in judging order.
if (x is Note && y is not Note) return -1;
if (x is not Note && y is Note) return 1;
var xNote = x as Note;
var yNote = y as Note;
return x.Column.CompareTo(y.Column);
// due to the way input is handled in mania, notes take precedence over ticks in judging order.
if (xNote != null && yNote == null) return -1;
if (xNote == null && yNote != null) return 1;
return xNote!.Column.CompareTo(yNote!.Column);
}
}
}