Allow string values for radio buttons in options menu (#896)

* Allow string values for radio buttons in options menu :D

NOT sure why this wasn't already a thing.... But it's here now

* Fix NaN check

---------

Co-authored-by: Ralty <78720179+Raltyro@users.noreply.github.com>
This commit is contained in:
Nebula S. Nova
2026-02-03 12:21:09 +07:00
committed by GitHub
co-authored by Ralty
parent bbb16f4c5c
commit 47a3526178
+3 -3
View File
@@ -202,8 +202,8 @@ class OptionsMenu extends TreeMenu {
Logs.warn("A radio option requires an \"id\" for option saving.");
continue;
}
var v:Dynamic = Std.parseFloat(node.att.value);
options.push(new RadioButton(screen, name, desc, node.att.id, v != null ? v : node.att.value, null, FlxG.save.data, node.has.forId ? node.att.forId : null));
var f = Std.parseFloat(node.att.value);
options.push(new RadioButton(screen, name, desc, node.att.id, f == Math.NaN ? node.att.value : f, null, FlxG.save.data, node.has.forId ? node.att.forId : null));
case 'slider':
if (!node.has.id) {
Logs.warn("A slider option requires an \"id\" for option saving.");
@@ -223,4 +223,4 @@ class OptionsMenu extends TreeMenu {
return options;
}
}
}