Fix sample additions not falling back to non-addition bank

This commit is contained in:
smoogipoo 2018-11-05 17:35:24 +09:00
parent 09b2710fbf
commit 92d570342c
3 changed files with 18 additions and 1 deletions

View File

@ -333,5 +333,18 @@ public void TestDecodeHitObjectFileSamples()
SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]);
}
[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

@ -240,7 +240,7 @@ private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
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]);