Merge pull request #3217 from smoogipoo/fix-samples

Fix new control points with same start time not replacing existing ones
This commit is contained in:
Dean Herbert 2018-08-14 11:55:23 +09:00 committed by GitHub
commit da01501a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -354,6 +354,11 @@ private void handleTimingPoint(string line)
private void handleTimingControlPoint(TimingControlPoint newPoint)
{
var existing = beatmap.ControlPointInfo.TimingPointAt(newPoint.Time);
if (existing.Time == newPoint.Time)
beatmap.ControlPointInfo.TimingPoints.Remove(existing);
beatmap.ControlPointInfo.TimingPoints.Add(newPoint);
}
@ -364,7 +369,9 @@ private void handleDifficultyControlPoint(DifficultyControlPoint newPoint)
if (newPoint.EquivalentTo(existing))
return;
beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time);
if (existing.Time == newPoint.Time)
beatmap.ControlPointInfo.DifficultyPoints.Remove(existing);
beatmap.ControlPointInfo.DifficultyPoints.Add(newPoint);
}
@ -375,6 +382,9 @@ private void handleEffectControlPoint(EffectControlPoint newPoint)
if (newPoint.EquivalentTo(existing))
return;
if (existing.Time == newPoint.Time)
beatmap.ControlPointInfo.EffectPoints.Remove(existing);
beatmap.ControlPointInfo.EffectPoints.Add(newPoint);
}
@ -385,6 +395,9 @@ private void handleSampleControlPoint(SampleControlPoint newPoint)
if (newPoint.EquivalentTo(existing))
return;
if (existing.Time == newPoint.Time)
beatmap.ControlPointInfo.SamplePoints.Remove(existing);
beatmap.ControlPointInfo.SamplePoints.Add(newPoint);
}