mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-09 15:39:55 +00:00
sorting custom modes
This commit is contained in:
parent
05309e3272
commit
94c02b5082
@ -818,8 +818,7 @@ EX void showChangeMode() {
|
|||||||
dialog::addItem(XLAT("highlights & achievements"), 'h');
|
dialog::addItem(XLAT("highlights & achievements"), 'h');
|
||||||
dialog::add_action_push(mode_higlights);
|
dialog::add_action_push(mode_higlights);
|
||||||
dialog::addItem(XLAT("custom mode manager"), 'm');
|
dialog::addItem(XLAT("custom mode manager"), 'm');
|
||||||
dialog::add_action([] { scores::load_only(); pushScreen(show_custom); });
|
dialog::add_action(prepare_custom);
|
||||||
|
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
@ -1265,8 +1264,7 @@ int read_menu_args() {
|
|||||||
}
|
}
|
||||||
else if(argis("-d:custom")) {
|
else if(argis("-d:custom")) {
|
||||||
PHASEFROM(3);
|
PHASEFROM(3);
|
||||||
scores::load_only();
|
prepare_custom();
|
||||||
launch_dialog(show_custom);
|
|
||||||
}
|
}
|
||||||
else if(argis("-d:history")) {
|
else if(argis("-d:history")) {
|
||||||
PHASEFROM(2); launch_dialog(history::history_menu);
|
PHASEFROM(2); launch_dialog(history::history_menu);
|
||||||
|
75
yendor.cpp
75
yendor.cpp
@ -1487,6 +1487,52 @@ EX bool include_unused_modes;
|
|||||||
|
|
||||||
EX string mode_to_search;
|
EX string mode_to_search;
|
||||||
|
|
||||||
|
int gscore(modecode_t xc) { if(!qty_scores_for.count(xc)) return 0; return qty_scores_for[xc]; }
|
||||||
|
int gscoreall(modecode_t xc) { return gscore(xc) * 100 + tactic::compute_tscore(xc) * 10 + yendor::compute_tscore(xc); }
|
||||||
|
string gdisplay(modecode_t xc) {
|
||||||
|
if(mode_description_of.count(xc)) return mode_description_of[xc];
|
||||||
|
else return "(mode " + its(xc) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
EX vector<modecode_t> mode_list;
|
||||||
|
|
||||||
|
EX void prepare_custom() {
|
||||||
|
scores::load_only();
|
||||||
|
gen_mode_list();
|
||||||
|
pushScreen(show_custom);
|
||||||
|
}
|
||||||
|
|
||||||
|
EX void gen_mode_list() {
|
||||||
|
mode_list.clear();
|
||||||
|
for(auto m: meaning)
|
||||||
|
mode_list.push_back(m.first);
|
||||||
|
}
|
||||||
|
|
||||||
|
EX void set_mode_sort_order() {
|
||||||
|
cmode = sm::SIDE | sm::MAYDARK;
|
||||||
|
gamescreen();
|
||||||
|
|
||||||
|
dialog::init(XLAT("set mode sort order"), iinf[itOrbYendor].color, 150, 100);
|
||||||
|
|
||||||
|
dialog::addItem(XLAT("reverse order"), 'r');
|
||||||
|
dialog::add_action([] { reverse(mode_list.begin(), mode_list.end()); popScreen(); });
|
||||||
|
|
||||||
|
dialog::addItem(XLAT("by number of scores"), 's');
|
||||||
|
dialog::add_action([] { stable_sort(mode_list.begin(), mode_list.end(), [] (modecode_t a, modecode_t b) { return gscore(a) > gscore(b); }); popScreen(); });
|
||||||
|
|
||||||
|
dialog::addItem(XLAT("by Pure Tactics Mode score"), 't');
|
||||||
|
dialog::add_action([] { stable_sort(mode_list.begin(), mode_list.end(), [] (modecode_t a, modecode_t b) { return tactic::compute_tscore(a) > tactic::compute_tscore(b); }); popScreen(); });
|
||||||
|
|
||||||
|
dialog::addItem(XLAT("by Yendor Challenge score"), 'y');
|
||||||
|
dialog::add_action([] { stable_sort(mode_list.begin(), mode_list.end(), [] (modecode_t a, modecode_t b) { return yendor::compute_tscore(a) > yendor::compute_tscore(b); }); popScreen(); });
|
||||||
|
|
||||||
|
dialog::addItem(XLAT("alphabetically"), 'a');
|
||||||
|
dialog::add_action([] { stable_sort(mode_list.begin(), mode_list.end(), [] (modecode_t a, modecode_t b) { return gdisplay(a) < gdisplay(b); }); popScreen(); });
|
||||||
|
|
||||||
|
dialog::addBack();
|
||||||
|
dialog::display();
|
||||||
|
}
|
||||||
|
|
||||||
EX void list_saved_custom_modes() {
|
EX void list_saved_custom_modes() {
|
||||||
dialog::start_list(2000, 2000, 'a');
|
dialog::start_list(2000, 2000, 'a');
|
||||||
|
|
||||||
@ -1498,35 +1544,32 @@ EX void list_saved_custom_modes() {
|
|||||||
|
|
||||||
vector<modecode_t> unid_modes;
|
vector<modecode_t> unid_modes;
|
||||||
|
|
||||||
for(auto m: meaning) {
|
for(auto m: mode_list) {
|
||||||
auto mf = m.first;
|
|
||||||
|
|
||||||
string out;
|
string out;
|
||||||
if(qty_scores_for.count(mf)) out += XLAT(" scores: %1", its(qty_scores_for[mf]));
|
if(qty_scores_for.count(m)) out += XLAT(" scores: %1", its(qty_scores_for[m]));
|
||||||
if(yendor::bestscore.count(mf)) out = XLAT(" Yendor: %1", its(yendor::compute_tscore(mf)));
|
if(yendor::bestscore.count(m)) out = XLAT(" Yendor: %1", its(yendor::compute_tscore(m)));
|
||||||
if(tactic::recordsum.count(m.first)) {
|
if(tactic::recordsum.count(m)) out += XLAT(" tactic: %1", its(tactic::compute_tscore(m)));
|
||||||
out += XLAT(" tactic: %1", its(tactic::compute_tscore(mf)));
|
|
||||||
}
|
|
||||||
if(out == "") { unused++; if(!include_unused_modes) continue; }
|
if(out == "") { unused++; if(!include_unused_modes) continue; }
|
||||||
else out = out.substr(1);
|
else out = out.substr(1);
|
||||||
if(mf == current_mc) mode_description_of[mf] = mode_description1();
|
if(m == current_mc) mode_description_of[m] = mode_description1();
|
||||||
string what;
|
string what = gdisplay(m);
|
||||||
if(mode_description_of.count(mf)) what = mode_description_of[mf];
|
if(!mode_description_of.count(m)) {
|
||||||
else {
|
|
||||||
what = "(mode " + its(mf) + ")";
|
|
||||||
unidentified++;
|
unidentified++;
|
||||||
unid_modes.push_back(mf);
|
unid_modes.push_back(m);
|
||||||
}
|
}
|
||||||
if(what.find(mode_to_search) == string::npos) continue;
|
if(what.find(mode_to_search) == string::npos) continue;
|
||||||
if(mf == current_mc) out += XLAT(" (ON)");
|
if(m == current_mc) out += XLAT(" (ON)");
|
||||||
dialog::addSelItem(what, out, dialog::list_fake_key++);
|
dialog::addSelItem(what, out, dialog::list_fake_key++);
|
||||||
dialog::add_action_confirmed([mf] { push_mode_screen_for(mf); });
|
dialog::add_action_confirmed([m] { push_mode_screen_for(m); });
|
||||||
allmodes++;
|
allmodes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog::end_list();
|
dialog::end_list();
|
||||||
|
|
||||||
dialog::addBreak(50);
|
dialog::addBreak(50);
|
||||||
|
dialog::addItem("mode sorting order", 'S');
|
||||||
|
dialog::add_action_push(set_mode_sort_order);
|
||||||
|
|
||||||
if(unused)
|
if(unused)
|
||||||
dialog::addBoolItem_action(XLAT("unused modes: %1", its(unused)), include_unused_modes, 'U');
|
dialog::addBoolItem_action(XLAT("unused modes: %1", its(unused)), include_unused_modes, 'U');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user