1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:03:08 +08:00

Merge remote-tracking branch 'origin/master' into fix-slider-samples

# Conflicts:
#	osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
This commit is contained in:
smoogipoo 2018-11-05 18:10:22 +09:00
commit ace1dce281
4 changed files with 21 additions and 5 deletions

View File

@ -377,5 +377,18 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(SampleInfo.HIT_CLAP, slider3.NodeSamples[2][1].Name);
}
}
[Test]
public void TestDecodeHitObjectNullAdditionBank()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = Resource.OpenResource("hitobject-no-addition-bank.osu"))
using (var stream = new StreamReader(resStream))
{
var hitObjects = decoder.Decode(stream).HitObjects;
Assert.AreEqual(hitObjects[0].Samples[0].Bank, hitObjects[0].Samples[1].Bank);
}
}
}
}

View File

@ -0,0 +1,4 @@
osu file format v14
[HitObjects]
444,320,1000,5,2,3:0:1:0:

View File

@ -3,7 +3,6 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Framework.Lists;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
@ -56,7 +55,7 @@ namespace osu.Game.Rulesets.Objects
/// </summary>
public HitWindows HitWindows { get; set; }
private readonly SortedList<HitObject> nestedHitObjects = new SortedList<HitObject>(compareObjects);
private readonly List<HitObject> nestedHitObjects = new List<HitObject>();
[JsonIgnore]
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects;
@ -74,6 +73,8 @@ namespace osu.Game.Rulesets.Objects
CreateNestedHitObjects();
nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
foreach (var h in nestedHitObjects)
{
h.HitWindows = HitWindows;
@ -114,7 +115,5 @@ namespace osu.Game.Rulesets.Objects
/// </para>
/// </summary>
protected virtual HitWindows CreateHitWindows() => new HitWindows();
private static int compareObjects(HitObject first, HitObject second) => first.StartTime.CompareTo(second.StartTime);
}
}

View File

@ -245,7 +245,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
stringAddBank = null;
bankInfo.Normal = stringBank;
bankInfo.Add = stringAddBank;
bankInfo.Add = string.IsNullOrEmpty(stringAddBank) ? stringBank : stringAddBank;
if (split.Length > 2)
bankInfo.CustomSampleBank = int.Parse(split[2]);