1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 06:27:17 +00:00

do not generate modecodes without need

This commit is contained in:
Zeno Rogue 2024-06-22 02:04:34 +02:00
parent b587851f47
commit b3d3661e13
3 changed files with 7 additions and 4 deletions

View File

@ -511,6 +511,7 @@ EX void show_custom() {
auto m = at_or_null(modename, current_modecode);
dialog::addSelItem("name custom mode", m ? *m : "", 'N');
dialog::add_action([] {
modecode();
name_to_edit = modename[current_modecode];
dialog::edit_string(name_to_edit, "name custom mode", "");
dialog::get_di().reaction_final = [] { update_modename(name_to_edit); };

View File

@ -171,7 +171,7 @@ EX void initgame() {
DEBBI(DF_INIT, ("initGame"));
callhooks(hooks_initgame);
modecode();
modecode(1);
if(!safety) fix_land_structure_choice();

View File

@ -1156,7 +1156,7 @@ EX modecode_t modecode(int mode) {
if(code_for.count(nover)) return code_for[nover];
if(mode == 1) return UNKNOWN;
if(mode == 1) return current_modecode = UNKNOWN;
modecode_t next = FIRST_MODECODE;
while(meaning.count(next)) next++;
@ -1211,6 +1211,7 @@ EX void load_modename_line(string s) {
}
EX void update_modename(string newname) {
modecode();
string old = modename.count(current_modecode) ? modename[current_modecode] : "";
if(old == newname) return;
if(newname == "") modename.erase(current_modecode);
@ -1442,7 +1443,7 @@ void mode_screen_for_current() {
cmode = sm::SIDE | sm::MAYDARK;
gamescreen();
modecode();
modecode(1);
auto& mc = current_modecode;
dialog::init(XLAT("recorded mode %1", its(mc)), iinf[itOrbYendor].color, 150, 100);
dialog::addInfo(mode_description1());
@ -1450,7 +1451,7 @@ void mode_screen_for_current() {
dialog::addBreak(100);
dialog::addSelItem(XLAT("scores recorded"), its(qty_scores_for[mc]), 's');
dialog::add_action([] { scores::load(); scores::which_mode = current_modecode; });
dialog::add_action([] { modecode(); scores::load(); scores::which_mode = current_modecode; });
dialog::addSelItem(XLAT("Yendor Challenge"), its(yendor::compute_tscore(mc)), 'y');
dialog::add_action([] {
@ -1523,6 +1524,7 @@ EX vector<modecode_t> mode_list;
EX map<modecode_t, string> modename;
EX void prepare_custom() {
modecode();
scores::load_only();
gen_mode_list();
pushScreen(show_custom);