mirror of https://github.com/ppy/osu
Make LegacyTotalScore nullable
This commit is contained in:
parent
c816281494
commit
ddd870e843
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
|
@ -227,6 +228,8 @@ public static long ConvertFromLegacyTotalScore(ScoreInfo score, DifficultyAttrib
|
|||
if (!score.IsLegacyScore)
|
||||
return score.TotalScore;
|
||||
|
||||
Debug.Assert(score.LegacyTotalScore != null);
|
||||
|
||||
int maximumLegacyAccuracyScore = attributes.LegacyAccuracyScore;
|
||||
int maximumLegacyComboScore = attributes.LegacyComboScore;
|
||||
double maximumLegacyBonusRatio = attributes.LegacyBonusScoreRatio;
|
||||
|
@ -239,7 +242,7 @@ public static long ConvertFromLegacyTotalScore(ScoreInfo score, DifficultyAttrib
|
|||
double comboProportion = Math.Min(1, (double)score.LegacyTotalScore / maximumLegacyBaseScore);
|
||||
|
||||
// The bonus proportion makes up the rest of the score that exceeds maximumLegacyBaseScore.
|
||||
double bonusProportion = Math.Max(0, (score.LegacyTotalScore - maximumLegacyBaseScore) * maximumLegacyBonusRatio);
|
||||
double bonusProportion = Math.Max(0, ((long)score.LegacyTotalScore - maximumLegacyBaseScore) * maximumLegacyBonusRatio);
|
||||
|
||||
switch (score.Ruleset.OnlineID)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ScoreInfo : RealmObject, IHasGuidPrimaryKey, IHasRealmFiles, ISoftD
|
|||
/// <remarks>
|
||||
/// Not populated if <see cref="IsLegacyScore"/> is <c>false</c>.
|
||||
/// </remarks>
|
||||
public long LegacyTotalScore { get; set; }
|
||||
public long? LegacyTotalScore { get; set; }
|
||||
|
||||
public int MaxCombo { get; set; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue