1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-08 09:24:06 +00:00

identify only used unidentified modes

This commit is contained in:
Zeno Rogue 2024-06-02 18:01:18 +02:00
parent f80492f365
commit c5cc8be04f

View File

@ -1485,6 +1485,8 @@ EX void list_saved_custom_modes() {
int unused = 0; int unused = 0;
int allmodes = 0; int allmodes = 0;
vector<modecode_t> unid_modes;
for(auto m: meaning) { for(auto m: meaning) {
auto mf = m.first; auto mf = m.first;
@ -1499,7 +1501,11 @@ EX void list_saved_custom_modes() {
if(mf == current_mc) mode_description_of[mf] = mode_description1(); if(mf == current_mc) mode_description_of[mf] = mode_description1();
string what; string what;
if(mode_description_of.count(mf)) what = mode_description_of[mf]; if(mode_description_of.count(mf)) what = mode_description_of[mf];
else what = "(mode " + its(mf) + ")", unidentified++; else {
what = "(mode " + its(mf) + ")";
unidentified++;
unid_modes.push_back(mf);
}
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(mf == current_mc) out += XLAT(" (ON)");
dialog::addSelItem(what, out, dialog::list_fake_key++); dialog::addSelItem(what, out, dialog::list_fake_key++);
@ -1520,10 +1526,10 @@ EX void list_saved_custom_modes() {
if(unidentified) { if(unidentified) {
dialog::addSelItem(XLAT("unidentified modes"), its(unidentified), 'I'); dialog::addSelItem(XLAT("unidentified modes"), its(unidentified), 'I');
dialog::add_action_confirmed([] { dialog::add_action_confirmed([unid_modes] {
for(auto m: meaning) if(!mode_description_of.count(m.first)) { for(auto m: unid_modes) {
enable_mode_by_code(m.first); enable_mode_by_code(m);
println(hlog, "identified ", m.first, " as ", mode_description_of[m.first]); println(hlog, "identified ", m, " as ", mode_description_of[m]);
} }
start_game(); start_game();
}); });