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

Fixing null reference exception bugs

This commit is contained in:
frankhjwx 2018-05-21 13:31:00 +08:00
parent 871743204b
commit 2e5bc4323a
2 changed files with 7 additions and 6 deletions

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
difficultyHitObjects.Clear();
float circleSize = Beatmap.BeatmapInfo.BaseDifficulty.CircleSize;
float catcherWidth = (1.0f - 0.7f * (circleSize - 5) / 5) * 0.62064f * CatcherArea.CATCHER_SIZE;
float catcherWidth = ((1.0f - 0.7f * (circleSize - 5) / 5) * 0.62064f) * CatcherArea.CATCHER_SIZE;
float catcherWidthHalf = catcherWidth / 2;
catcherWidthHalf *= 0.8f;
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
double ar = Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate;
double preEmpt = BeatmapDifficulty.DifficultyRange(ar, 1800, 1200, 450) / TimeRate;
categoryDifficulty["AR"] = preEmpt > 1200.0 ? -(preEmpt - 1800.0) / 120.0 : -(preEmpt - 1200.0) / 150.0 + 5.0;
categoryDifficulty["AR"] = (preEmpt > 1200.0) ? -(preEmpt - 1800.0) / 120.0 : (-(preEmpt - 1200.0) / 150.0) + 5.0;
categoryDifficulty["Max combo"] = difficultyHitObjects.Count;
}
@ -92,7 +92,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty
while (hitObjectsEnumerator.MoveNext())
{
CatchDifficultyHitObject nextHitObject = hitObjectsEnumerator.Current;
nextHitObject.CalculateStrains(currentHitObject, TimeRate);
if (nextHitObject != null)
nextHitObject.CalculateStrains(currentHitObject, TimeRate);
currentHitObject = nextHitObject;
}

View File

@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
{
internal class CatchDifficultyHitObject
{
internal static readonly double decay_base = 0.20;
internal static readonly double DECAY_BASE = 0.20;
private const float normalized_hitobject_radius = 41.0f;
private const float absolute_player_positioning_error = 16f;
private readonly float playerPositioningError;
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
// Rather simple, but more specialized things are inherently inaccurate due to the big difference playstyles and opinions make.
// See Taiko feedback thread.
double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate;
double decay = Math.Pow(decay_base, timeElapsed / 1000);
double decay = Math.Pow(DECAY_BASE, timeElapsed / 1000);
// Update new position with lazy movement.
PlayerPositionOffset =