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

Properly annotate method to allow null

This commit is contained in:
Dan Balasescu 2022-06-20 16:52:01 +09:00
parent ca287d0936
commit 16281f4a48
6 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
/// <param name="existing">An existing control point to compare with.</param>
/// <returns>Whether this <see cref="ControlPoint"/> is redundant when placed alongside <paramref name="existing"/>.</returns>
public abstract bool IsRedundant(ControlPoint existing);
public abstract bool IsRedundant(ControlPoint? existing);
/// <summary>
/// Create an unbound copy of this control point.

View File

@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps.ControlPoints
set => SliderVelocityBindable.Value = value;
}
public override bool IsRedundant(ControlPoint existing)
public override bool IsRedundant(ControlPoint? existing)
=> existing is DifficultyControlPoint existingDifficulty
&& SliderVelocity == existingDifficulty.SliderVelocity;

View File

@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps.ControlPoints
set => KiaiModeBindable.Value = value;
}
public override bool IsRedundant(ControlPoint existing)
public override bool IsRedundant(ControlPoint? existing)
=> !OmitFirstBarLine
&& existing is EffectControlPoint existingEffect
&& KiaiMode == existingEffect.KiaiMode

View File

@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps.ControlPoints
public virtual HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo)
=> hitSampleInfo.With(newBank: hitSampleInfo.Bank ?? SampleBank, newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume);
public override bool IsRedundant(ControlPoint existing)
public override bool IsRedundant(ControlPoint? existing)
=> existing is SampleControlPoint existingSample
&& SampleBank == existingSample.SampleBank
&& SampleVolume == existingSample.SampleVolume;

View File

@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps.ControlPoints
public double BPM => 60000 / BeatLength;
// Timing points are never redundant as they can change the time signature.
public override bool IsRedundant(ControlPoint existing) => false;
public override bool IsRedundant(ControlPoint? existing) => false;
public override void CopyFrom(ControlPoint other)
{

View File

@ -213,7 +213,7 @@ namespace osu.Game.Beatmaps.Formats
return baseInfo;
}
public override bool IsRedundant(ControlPoint existing)
public override bool IsRedundant(ControlPoint? existing)
=> base.IsRedundant(existing)
&& existing is LegacySampleControlPoint existingSample
&& CustomSampleBank == existingSample.CustomSampleBank;