1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Merge pull request #16686 from peppy/fix-ar-on-old-maps

Fix approach rate not being transferred from OD on older beatmaps
This commit is contained in:
Dan Balasescu 2022-01-28 20:17:37 +09:00 committed by GitHub
commit 8883505eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 0 deletions

View File

@ -821,5 +821,47 @@ namespace osu.Game.Tests.Beatmaps.Formats
});
}
}
[Test]
public void TestUndefinedApproachRateInheritsOverallDifficulty()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("undefined-approach-rate.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoded = decoder.Decode(stream);
Assert.That(decoded.Difficulty.ApproachRate, Is.EqualTo(1));
Assert.That(decoded.Difficulty.OverallDifficulty, Is.EqualTo(1));
}
}
[Test]
public void TestApproachRateDefinedBeforeOverallDifficulty()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("approach-rate-before-overall-difficulty.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoded = decoder.Decode(stream);
Assert.That(decoded.Difficulty.ApproachRate, Is.EqualTo(9));
Assert.That(decoded.Difficulty.OverallDifficulty, Is.EqualTo(1));
}
}
[Test]
public void TestApproachRateDefinedAfterOverallDifficulty()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("approach-rate-after-overall-difficulty.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoded = decoder.Decode(stream);
Assert.That(decoded.Difficulty.ApproachRate, Is.EqualTo(9));
Assert.That(decoded.Difficulty.OverallDifficulty, Is.EqualTo(1));
}
}
}
}

View File

@ -0,0 +1,3 @@
[Difficulty]
OverallDifficulty:1
ApproachRate:9

View File

@ -0,0 +1,3 @@
[Difficulty]
ApproachRate:9
OverallDifficulty:1

View File

@ -0,0 +1,2 @@
[Difficulty]
OverallDifficulty:1

View File

@ -311,10 +311,13 @@ namespace osu.Game.Beatmaps.Formats
case @"OverallDifficulty":
difficulty.OverallDifficulty = Parsing.ParseFloat(pair.Value);
if (!hasApproachRate)
difficulty.ApproachRate = difficulty.OverallDifficulty;
break;
case @"ApproachRate":
difficulty.ApproachRate = Parsing.ParseFloat(pair.Value);
hasApproachRate = true;
break;
case @"SliderMultiplier":
@ -432,6 +435,7 @@ namespace osu.Game.Beatmaps.Formats
private readonly List<ControlPoint> pendingControlPoints = new List<ControlPoint>();
private readonly HashSet<Type> pendingControlPointTypes = new HashSet<Type>();
private double pendingControlPointsTime;
private bool hasApproachRate;
private void addControlPoint(double time, ControlPoint point, bool timingChange)
{