1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 20:13:16 +08:00

Remove redundant null initialisation and apply nullability

This commit is contained in:
Dean Herbert 2024-11-14 13:37:53 +09:00
parent 7670a81181
commit d37c1bb6d0
No known key found for this signature in database

View File

@ -1,9 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using JetBrains.Annotations;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Difficulty;
@ -25,20 +22,18 @@ namespace osu.Game.Beatmaps
/// The difficulty attributes computed for the given beatmap. /// The difficulty attributes computed for the given beatmap.
/// Might not be available if the star difficulty is associated with a beatmap that's not locally available. /// Might not be available if the star difficulty is associated with a beatmap that's not locally available.
/// </summary> /// </summary>
[CanBeNull] public readonly DifficultyAttributes? DifficultyAttributes;
public readonly DifficultyAttributes DifficultyAttributes;
/// <summary> /// <summary>
/// The performance attributes computed for a perfect score on the given beatmap. /// The performance attributes computed for a perfect score on the given beatmap.
/// Might not be available if the star difficulty is associated with a beatmap that's not locally available. /// Might not be available if the star difficulty is associated with a beatmap that's not locally available.
/// </summary> /// </summary>
[CanBeNull] public readonly PerformanceAttributes? PerformanceAttributes;
public readonly PerformanceAttributes PerformanceAttributes;
/// <summary> /// <summary>
/// Creates a <see cref="StarDifficulty"/> structure. /// Creates a <see cref="StarDifficulty"/> structure.
/// </summary> /// </summary>
public StarDifficulty([NotNull] DifficultyAttributes difficulty, [NotNull] PerformanceAttributes performance) public StarDifficulty(DifficultyAttributes difficulty, PerformanceAttributes performance)
{ {
Stars = double.IsFinite(difficulty.StarRating) ? difficulty.StarRating : 0; Stars = double.IsFinite(difficulty.StarRating) ? difficulty.StarRating : 0;
MaxCombo = difficulty.MaxCombo; MaxCombo = difficulty.MaxCombo;
@ -55,7 +50,6 @@ namespace osu.Game.Beatmaps
{ {
Stars = double.IsFinite(starDifficulty) ? starDifficulty : 0; Stars = double.IsFinite(starDifficulty) ? starDifficulty : 0;
MaxCombo = maxCombo; MaxCombo = maxCombo;
DifficultyAttributes = null;
} }
public DifficultyRating DifficultyRating => GetDifficultyRating(Stars); public DifficultyRating DifficultyRating => GetDifficultyRating(Stars);