1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +00:00

tes:: fixed -arb-slider option

This commit is contained in:
Zeno Rogue 2022-04-24 22:27:55 +02:00
parent a8412ac5f0
commit ee475ac5b7

View File

@ -1265,7 +1265,7 @@ EX void run(string fname) {
string slider_error; string slider_error;
EX void sliders_changed(bool need_restart) { EX void sliders_changed(bool need_restart, bool need_start) {
if(need_restart) stop_game(); if(need_restart) stop_game();
auto& c = current_or_slided(); auto& c = current_or_slided();
arbi_tiling backup = c; arbi_tiling backup = c;
@ -1285,7 +1285,7 @@ EX void sliders_changed(bool need_restart) {
c = backup; c = backup;
slider_error = poly.generate_error(); slider_error = poly.generate_error();
} }
if(need_restart) start_game(); if(need_restart && need_start) start_game();
} }
EX void set_sliders() { EX void set_sliders() {
@ -1298,7 +1298,7 @@ EX void set_sliders() {
dialog::addSelItem(sl.name, fts(sl.current), ch++); dialog::addSelItem(sl.name, fts(sl.current), ch++);
dialog::add_action([&] { dialog::add_action([&] {
dialog::editNumber(sl.current, sl.min, sl.max, 1, sl.zero, sl.name, sl.name); dialog::editNumber(sl.current, sl.min, sl.max, 1, sl.zero, sl.name, sl.name);
dialog::reaction = [] { sliders_changed(false); }; dialog::reaction = [] { sliders_changed(false, false); };
}); });
} }
if(isize(current.intsliders)) if(isize(current.intsliders))
@ -1307,7 +1307,7 @@ EX void set_sliders() {
dialog::addSelItem(sl.name, its(sl.current), ch++); dialog::addSelItem(sl.name, its(sl.current), ch++);
dialog::add_action([&] { dialog::add_action([&] {
dialog::editNumber(sl.current, sl.min, sl.max, 1, sl.zero, sl.name, sl.name); dialog::editNumber(sl.current, sl.min, sl.max, 1, sl.zero, sl.name, sl.name);
dialog::reaction = [] { sliders_changed(true); }; dialog::reaction = [] { sliders_changed(true, true); };
}); });
} }
dialog::addInfo(slider_error); dialog::addInfo(slider_error);
@ -1566,14 +1566,14 @@ int readArgs() {
bool found = true; bool found = true;
for(auto& sl: current.sliders) for(auto& sl: current.sliders)
if(sl.name == slider) { if(sl.name == slider) {
shift_arg_formula(sl.current, [] { sliders_changed(false); }); shift_arg_formula(sl.current, [] { sliders_changed(false, false); });
found = true; found = true;
} }
for(auto& sl: current.intsliders) for(auto& sl: current.intsliders)
if(sl.name == slider) { if(sl.name == slider) {
shift(); sl.current = argi(); shift(); sl.current = argi();
stop_game(); stop_game();
sliders_changed(false); sliders_changed(true, false);
found = true; found = true;
} }
if(!found) { if(!found) {