From be27447de96f0d74f009ecd5862482fdacf7ef47 Mon Sep 17 00:00:00 2001 From: Jurta <29545237+Jurtaa@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:41:04 +0000 Subject: [PATCH] Prevent empty difficulty strings from accidentally existing (#832) * Prevent empty difficulty strings from being inputted * Also taking into account variants + making separator only show up when both difficulty and variant options are available --- source/funkin/editors/charter/CharterSelection.hx | 6 +++--- source/funkin/editors/charter/SongCreationScreen.hx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/funkin/editors/charter/CharterSelection.hx b/source/funkin/editors/charter/CharterSelection.hx index cedadad0..420f3227 100644 --- a/source/funkin/editors/charter/CharterSelection.hx +++ b/source/funkin/editors/charter/CharterSelection.hx @@ -40,7 +40,7 @@ class CharterSelectionScreen extends EditorTreeMenuScreen { var screen = new EditorTreeMenuScreen((first || !isVariant) ? (s.name + (isVariant ? ' (${s.variant})' : '')) : s.variant, getID('selectDifficulty')); for (d in s.difficulties) if (d != '') screen.add(makeChartOption(d, isVariant ? s.variant : null, s.name)); - screen.add(new Separator()); + if (s.difficulties.length > 0 && s.variants.length > 0) screen.add(new Separator()); // Create a separator only when there are both difficulty and variant options available. for (v in s.variants) if (s.metas.get(v) != null) screen.add(makeVariationOption(s.metas.get(v))); #if sys @@ -48,13 +48,13 @@ class CharterSelectionScreen extends EditorTreeMenuScreen { parent.openSubState(new ChartCreationScreen(saveChart)); })); - if (!first) screen.curSelected = 1; + if (!first) screen.curSelected = (s.difficulties.length + s.variants.length) > 0 ? 1 : 0; else { cast(screen.members[0], NewOption).itemHeight = 120; screen.insert(1, new NewOption(getID('newVariation'), getID('newVariationDesc'), () -> { parent.openSubState(new VariationCreationScreen(s, saveSong)); })); - screen.curSelected = 2; + screen.curSelected = (s.difficulties.length + s.variants.length) > 0 ? 2 : 1; } #end diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index 92a1406f..2a345fa2 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -435,7 +435,7 @@ class SongCreationScreen extends UISubstateWindow { color: colorWheel.curColor, opponentModeAllowed: opponentModeCheckbox.checked, coopAllowed: coopAllowedCheckbox.checked, - difficulties: [for (diff in difficultiesTextBox.label.text.split(",")) diff.trim()] + difficulties: [for (diff in difficultiesTextBox.label.text.split(",")) if (diff.length > 0) diff.trim()] }); if (onSave != null) onSave({