mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 18:42:56 +08:00
Fix time being a part of controlpoint change comparisons
This commit is contained in:
parent
c78bfbfa55
commit
b664d3ef81
@ -14,12 +14,15 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
||||||
|
|
||||||
public virtual bool Equals(ControlPoint other)
|
/// <summary>
|
||||||
{
|
/// Whether this <see cref="ControlPoint"/> provides the same changes to gameplay as another <see cref="ControlPoint"/>.
|
||||||
if (ReferenceEquals(null, other)) return false;
|
/// </summary>
|
||||||
if (ReferenceEquals(this, other)) return true;
|
/// <param name="other">The <see cref="ControlPoint"/> to compare to.</param>
|
||||||
|
/// <returns>Whether this <see cref="ControlPoint"/> provides the same changes to gameplay as <paramref name="other"/>.</returns>
|
||||||
|
public virtual bool ChangeEquals(ControlPoint other) => !ReferenceEquals(null, other);
|
||||||
|
|
||||||
return Time.Equals(other.Time);
|
public bool Equals(ControlPoint other)
|
||||||
}
|
=> ChangeEquals(other)
|
||||||
|
&& Time.Equals(other.Time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
private double speedMultiplier = 1;
|
private double speedMultiplier = 1;
|
||||||
|
|
||||||
public override bool Equals(ControlPoint other)
|
public override bool ChangeEquals(ControlPoint other)
|
||||||
=> base.Equals(other)
|
=> base.ChangeEquals(other)
|
||||||
&& other is DifficultyControlPoint difficulty
|
&& other is DifficultyControlPoint difficulty
|
||||||
&& SpeedMultiplier.Equals(difficulty.SpeedMultiplier);
|
&& SpeedMultiplier.Equals(difficulty.SpeedMultiplier);
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool OmitFirstBarLine;
|
public bool OmitFirstBarLine;
|
||||||
|
|
||||||
public override bool Equals(ControlPoint other)
|
public override bool ChangeEquals(ControlPoint other)
|
||||||
=> base.Equals(other)
|
=> base.ChangeEquals(other)
|
||||||
&& other is EffectControlPoint effect
|
&& other is EffectControlPoint effect
|
||||||
&& KiaiMode.Equals(effect.KiaiMode)
|
&& KiaiMode.Equals(effect.KiaiMode)
|
||||||
&& OmitFirstBarLine.Equals(effect.OmitFirstBarLine);
|
&& OmitFirstBarLine.Equals(effect.OmitFirstBarLine);
|
||||||
|
@ -43,8 +43,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume
|
Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume
|
||||||
};
|
};
|
||||||
|
|
||||||
public override bool Equals(ControlPoint other)
|
public override bool ChangeEquals(ControlPoint other)
|
||||||
=> base.Equals(other)
|
=> base.ChangeEquals(other)
|
||||||
&& other is SampleControlPoint sample
|
&& other is SampleControlPoint sample
|
||||||
&& SampleBank.Equals(sample.SampleBank)
|
&& SampleBank.Equals(sample.SampleBank)
|
||||||
&& SampleVolume.Equals(sample.SampleVolume);
|
&& SampleVolume.Equals(sample.SampleVolume);
|
||||||
|
@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
private double beatLength = 1000;
|
private double beatLength = 1000;
|
||||||
|
|
||||||
public override bool Equals(ControlPoint other)
|
public override bool ChangeEquals(ControlPoint other)
|
||||||
=> base.Equals(other)
|
=> base.ChangeEquals(other)
|
||||||
&& other is TimingControlPoint timing
|
&& other is TimingControlPoint timing
|
||||||
&& TimeSignature.Equals(timing.TimeSignature)
|
&& TimeSignature.Equals(timing.TimeSignature)
|
||||||
&& BeatLength.Equals(timing.BeatLength);
|
&& BeatLength.Equals(timing.BeatLength);
|
||||||
|
@ -359,7 +359,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time);
|
var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time);
|
||||||
|
|
||||||
if (newPoint.Equals(existing))
|
if (newPoint.ChangeEquals(existing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time);
|
beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time);
|
||||||
@ -370,7 +370,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time);
|
var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time);
|
||||||
|
|
||||||
if (newPoint.Equals(existing))
|
if (newPoint.ChangeEquals(existing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.ControlPointInfo.EffectPoints.Add(newPoint);
|
beatmap.ControlPointInfo.EffectPoints.Add(newPoint);
|
||||||
@ -380,7 +380,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time);
|
var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time);
|
||||||
|
|
||||||
if (newPoint.Equals(existing))
|
if (newPoint.ChangeEquals(existing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.ControlPointInfo.SamplePoints.Add(newPoint);
|
beatmap.ControlPointInfo.SamplePoints.Add(newPoint);
|
||||||
|
@ -184,8 +184,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
return baseInfo;
|
return baseInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(ControlPoint other)
|
public override bool ChangeEquals(ControlPoint other)
|
||||||
=> base.Equals(other)
|
=> base.ChangeEquals(other)
|
||||||
&& other is LegacySampleControlPoint legacy
|
&& other is LegacySampleControlPoint legacy
|
||||||
&& CustomSampleBank == legacy.CustomSampleBank;
|
&& CustomSampleBank == legacy.CustomSampleBank;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user