Command repeating by using cmd queues

This replaces the old pushq/saveq arrays (which were used to save
the keys pressed by the user for repeating a previous command)
with a new command queue.  This means there's no hard-coded limit
to the saved keys, and it can repeat extended commands which are
not bound to any key.
This commit is contained in:
Pasi Kallinen
2022-08-08 14:02:59 +03:00
parent 4e6d3aba4f
commit fd9745f9c6
34 changed files with 417 additions and 379 deletions

View File

@@ -530,7 +530,7 @@ void NetHackQtMapViewport::Display(bool block)
change.clear();
if (block) {
yn_function("Press a key when done viewing", NULL, '\0');
yn_function("Press a key when done viewing", NULL, '\0', TRUE);
}
}

View File

@@ -583,12 +583,6 @@ int NetHackQtExtCmdRequestor::get()
exec();
int ret = result() - 1;
if (!::g.in_doagain) {
if (ret >= 0)
savech_extcmd(::extcmdlist[ret].ef_txt, FALSE);
else
savech(0);
}
return ret;
}

View File

@@ -1557,12 +1557,8 @@ X11_get_ext_cmd(void)
(void) x_event(EXIT_ON_EXIT);
if (extended_cmd_selected < 0) {
if (!g.in_doagain)
savech(0);
return -1;
}
if (!g.in_doagain)
savech_extcmd(command_list[extended_cmd_selected], TRUE);
return command_indx[extended_cmd_selected];
}

View File

@@ -496,20 +496,12 @@ curses_ext_cmd(void)
curses_destroy_win(extwin2);
if (ret != -1) {
if (!g.in_doagain)
savech_extcmd(cur_choice, TRUE);
} else {
char extcmd_char = extcmd_initiator();
if (*cur_choice)
pline("%s%s: unknown extended command.",
visctrl(extcmd_char), cur_choice);
if (!g.in_doagain) {
savech(0); /* reset do-again buffer */
if (letter != '\033')
savech(extcmd_char);
}
}
return ret;
}

View File

@@ -296,12 +296,9 @@ tty_get_ext_cmd(void)
if (nmatches != -1)
pline("%s%.60s: unknown extended command.",
visctrl(extcmd_char[0]), buf);
savech(0); /* reset do-again buffer */
savech(extcmd_char[0]);
return -1;
}
savech_extcmd(buf, TRUE); /* savech() for extcmd_char+buf[...]+'\n' */
return ecmatches[0];
}

View File

@@ -1848,12 +1848,6 @@ mswin_get_ext_cmd(void)
ret = -1;
}
if (!g.in_doagain) {
if (ret >= 0)
savech_extcmd(cmd, TRUE);
else
savech(0);
}
return ret;
}