From 18dc375fe974ca4464a24fd6ecb3e29dd31a0368 Mon Sep 17 00:00:00 2001 From: kstefanowicz Date: Tue, 20 Aug 2024 08:36:08 -0400 Subject: [PATCH] Refactor if/else as ternary conditional --- .../Beatmaps/Formats/LegacyBeatmapEncoder.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs index 3b0bfe613d..5f806837f2 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs @@ -220,18 +220,13 @@ namespace osu.Game.Beatmaps.Formats var samplePoint = legacyControlPoints.SamplePointAt(group.Time); var effectPoint = legacyControlPoints.EffectPointAt(group.Time); - // 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)); - } + // if samplePoint isn't already legacy, create LegacyHitSampleInfo with customSampleBank 1 // else create LegacyHitSampleInfo with existing customSampleBank - else - { - tempHitSample = samplePoint.ApplyTo(new ConvertHitObjectParser.LegacyHitSampleInfo(string.Empty)); - } + HitSampleInfo tempHitSample = samplePoint.ApplyTo( + samplePoint.GetType() == typeof(SampleControlPoint) + ? 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) int customSampleBank = toLegacyCustomSampleBank(tempHitSample);