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
This commit is contained in:
Jurta
2025-11-21 18:41:04 +07:00
committed by GitHub
parent a8808be29e
commit be27447de9
2 changed files with 4 additions and 4 deletions
@@ -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
@@ -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({