1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Use if statements rather than conditional case

This commit is contained in:
Dean Herbert 2023-02-10 17:03:27 +09:00
parent 96c1832af4
commit 1df6fc6311

View File

@ -581,27 +581,19 @@ namespace osu.Game.Rulesets.Scoring
/// </summary> /// </summary>
public static ScoreRank RankFromAccuracy(double accuracy) public static ScoreRank RankFromAccuracy(double accuracy)
{ {
switch (accuracy) if (accuracy == accuracy_cutoff_x)
{
case accuracy_cutoff_x:
return ScoreRank.X; return ScoreRank.X;
if (accuracy >= accuracy_cutoff_s)
case >= accuracy_cutoff_s:
return ScoreRank.S; return ScoreRank.S;
if (accuracy >= accuracy_cutoff_a)
case >= accuracy_cutoff_a:
return ScoreRank.A; return ScoreRank.A;
if (accuracy >= accuracy_cutoff_b)
case >= accuracy_cutoff_b:
return ScoreRank.B; return ScoreRank.B;
if (accuracy >= accuracy_cutoff_c)
case >= accuracy_cutoff_c:
return ScoreRank.C; return ScoreRank.C;
default:
return ScoreRank.D; return ScoreRank.D;
} }
}
/// <summary> /// <summary>
/// Given a <see cref="ScoreRank"/>, return the cutoff accuracy (0..1). /// Given a <see cref="ScoreRank"/>, return the cutoff accuracy (0..1).