From 87a7f340e3100b7f1ee1f9a2c4b05abdb194b86b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 13 Dec 2019 18:12:44 +0900 Subject: [PATCH 1/2] Fix first sample point being treated as redundant --- osu.Game.Tests/NonVisual/ControlPointInfoTest.cs | 12 ++++++------ osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs b/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs index a51b90851c..0535473a3f 100644 --- a/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs +++ b/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs @@ -60,18 +60,18 @@ namespace osu.Game.Tests.NonVisual { var cpi = new ControlPointInfo(); - cpi.Add(0, new SampleControlPoint()); // is redundant + cpi.Add(0, new SampleControlPoint()); // is *not* redundant, special exception for first sample point cpi.Add(1000, new SampleControlPoint()); // is redundant - Assert.That(cpi.Groups.Count, Is.EqualTo(0)); + Assert.That(cpi.Groups.Count, Is.EqualTo(1)); Assert.That(cpi.TimingPoints.Count, Is.EqualTo(0)); - Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(0)); + Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(1)); cpi.Add(1000, new SampleControlPoint { SampleVolume = 50 }); // is not redundant - Assert.That(cpi.Groups.Count, Is.EqualTo(1)); - Assert.That(cpi.SamplePoints.Count, Is.EqualTo(1)); - Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(1)); + Assert.That(cpi.Groups.Count, Is.EqualTo(2)); + Assert.That(cpi.SamplePoints.Count, Is.EqualTo(2)); + Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(2)); } [Test] diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index ce2783004c..6965544292 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -239,7 +239,7 @@ namespace osu.Game.Beatmaps.ControlPoints break; case SampleControlPoint _: - existing = SamplePointAt(time); + existing = binarySearch(SamplePoints, time); break; case DifficultyControlPoint _: From 36f541d8e5ce77a846646063ba10903a93690965 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 13 Dec 2019 18:13:24 +0900 Subject: [PATCH 2/2] Fix incorrect asserts --- osu.Game.Tests/NonVisual/ControlPointInfoTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs b/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs index 0535473a3f..2782e902fe 100644 --- a/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs +++ b/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs @@ -45,7 +45,7 @@ namespace osu.Game.Tests.NonVisual cpi.Add(1000, new DifficultyControlPoint()); // is redundant Assert.That(cpi.Groups.Count, Is.EqualTo(0)); - Assert.That(cpi.TimingPoints.Count, Is.EqualTo(0)); + Assert.That(cpi.DifficultyPoints.Count, Is.EqualTo(0)); Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(0)); cpi.Add(1000, new DifficultyControlPoint { SpeedMultiplier = 2 }); // is not redundant @@ -64,7 +64,7 @@ namespace osu.Game.Tests.NonVisual cpi.Add(1000, new SampleControlPoint()); // is redundant Assert.That(cpi.Groups.Count, Is.EqualTo(1)); - Assert.That(cpi.TimingPoints.Count, Is.EqualTo(0)); + Assert.That(cpi.SamplePoints.Count, Is.EqualTo(1)); Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(1)); cpi.Add(1000, new SampleControlPoint { SampleVolume = 50 }); // is not redundant @@ -83,7 +83,7 @@ namespace osu.Game.Tests.NonVisual cpi.Add(1000, new EffectControlPoint()); // is redundant Assert.That(cpi.Groups.Count, Is.EqualTo(0)); - Assert.That(cpi.TimingPoints.Count, Is.EqualTo(0)); + Assert.That(cpi.EffectPoints.Count, Is.EqualTo(0)); Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(0)); cpi.Add(1000, new EffectControlPoint { KiaiMode = true }); // is not redundant