mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 15:12:57 +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:
commit
8883505eed
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
[Difficulty]
|
||||||
|
OverallDifficulty:1
|
||||||
|
ApproachRate:9
|
@ -0,0 +1,3 @@
|
|||||||
|
[Difficulty]
|
||||||
|
ApproachRate:9
|
||||||
|
OverallDifficulty:1
|
2
osu.Game.Tests/Resources/undefined-approach-rate.osu
Normal file
2
osu.Game.Tests/Resources/undefined-approach-rate.osu
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Difficulty]
|
||||||
|
OverallDifficulty:1
|
@ -311,10 +311,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
case @"OverallDifficulty":
|
case @"OverallDifficulty":
|
||||||
difficulty.OverallDifficulty = Parsing.ParseFloat(pair.Value);
|
difficulty.OverallDifficulty = Parsing.ParseFloat(pair.Value);
|
||||||
|
if (!hasApproachRate)
|
||||||
|
difficulty.ApproachRate = difficulty.OverallDifficulty;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case @"ApproachRate":
|
case @"ApproachRate":
|
||||||
difficulty.ApproachRate = Parsing.ParseFloat(pair.Value);
|
difficulty.ApproachRate = Parsing.ParseFloat(pair.Value);
|
||||||
|
hasApproachRate = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case @"SliderMultiplier":
|
case @"SliderMultiplier":
|
||||||
@ -432,6 +435,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
private readonly List<ControlPoint> pendingControlPoints = new List<ControlPoint>();
|
private readonly List<ControlPoint> pendingControlPoints = new List<ControlPoint>();
|
||||||
private readonly HashSet<Type> pendingControlPointTypes = new HashSet<Type>();
|
private readonly HashSet<Type> pendingControlPointTypes = new HashSet<Type>();
|
||||||
private double pendingControlPointsTime;
|
private double pendingControlPointsTime;
|
||||||
|
private bool hasApproachRate;
|
||||||
|
|
||||||
private void addControlPoint(double time, ControlPoint point, bool timingChange)
|
private void addControlPoint(double time, ControlPoint point, bool timingChange)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user