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

Refactor if/else as ternary conditional

This commit is contained in:
kstefanowicz 2024-08-20 08:36:08 -04:00
parent 730f198c45
commit 18dc375fe9

View File

@ -220,18 +220,13 @@ namespace osu.Game.Beatmaps.Formats
var samplePoint = legacyControlPoints.SamplePointAt(group.Time); var samplePoint = legacyControlPoints.SamplePointAt(group.Time);
var effectPoint = legacyControlPoints.EffectPointAt(group.Time); var effectPoint = legacyControlPoints.EffectPointAt(group.Time);
// if samplePoint isn't already legacy,create LegacyHitSampleInfo with customSampleBank 1 // if samplePoint isn't already legacy, create LegacyHitSampleInfo with customSampleBank 1
HitSampleInfo tempHitSample;
if (samplePoint.GetType() == typeof(SampleControlPoint))
{
tempHitSample = samplePoint.ApplyTo(new ConvertHitObjectParser.LegacyHitSampleInfo(string.Empty, customSampleBank: 1));
}
// else create LegacyHitSampleInfo with existing customSampleBank // else create LegacyHitSampleInfo with existing customSampleBank
else HitSampleInfo tempHitSample = samplePoint.ApplyTo(
{ samplePoint.GetType() == typeof(SampleControlPoint)
tempHitSample = samplePoint.ApplyTo(new ConvertHitObjectParser.LegacyHitSampleInfo(string.Empty)); ? new ConvertHitObjectParser.LegacyHitSampleInfo(string.Empty, customSampleBank: 1)
} : new ConvertHitObjectParser.LegacyHitSampleInfo(string.Empty)
);
// Apply the control point to a hit sample to uncover legacy properties (e.g. suffix) // Apply the control point to a hit sample to uncover legacy properties (e.g. suffix)
int customSampleBank = toLegacyCustomSampleBank(tempHitSample); int customSampleBank = toLegacyCustomSampleBank(tempHitSample);