suppress sanity_check for invalid command ESC

If sanity_check starts spewing out warnings, don't run it again if
player types ESC when the program finally asks for the next command
(rather than --More--).

Also, some reformatting of the main command table.
This commit is contained in:
PatR
2024-06-30 17:33:41 -07:00
parent 02ddbf001b
commit dc9d0e279f
+8 -2
View File
@@ -1820,7 +1820,8 @@ struct ext_func_tab extcmdlist[] = {
doprtool, IFBURIED | CMD_M_PREFIX, NULL }, doprtool, IFBURIED | CMD_M_PREFIX, NULL },
{ WEAPON_SYM, "seeweapon", "show the weapon currently wielded", { WEAPON_SYM, "seeweapon", "show the weapon currently wielded",
doprwep, IFBURIED | CMD_M_PREFIX, NULL }, doprwep, IFBURIED | CMD_M_PREFIX, NULL },
{ '!', "shell", "leave game to enter a sub-shell ('exit' to come back)", { '!', "shell",
"leave game to enter a sub-shell ('exit' to come back)",
dosh_core, (IFBURIED | GENERALCMD | NOFUZZERCMD dosh_core, (IFBURIED | GENERALCMD | NOFUZZERCMD
#ifndef SHELL #ifndef SHELL
| CMD_NOT_AVAILABLE | CMD_NOT_AVAILABLE
@@ -3316,7 +3317,12 @@ rhack(int key)
/* if there's no command, there's nothing to do except reset */ /* if there's no command, there's nothing to do except reset */
if (!key || key == (char) 0377 if (!key || key == (char) 0377
|| key == gc.Cmd.spkeys[NHKF_ESC]) { || key == gc.Cmd.spkeys[NHKF_ESC]) {
if (!key || key != gc.Cmd.spkeys[NHKF_ESC]) if (key == gc.Cmd.spkeys[NHKF_ESC])
/* don't perform next sanity check if player typed ESC for
the current command, similar to handling for CMD_INSANE
flag below (^P and ^R) */
iflags.sanity_no_check = iflags.sanity_check;
else
nhbell(); nhbell();
reset_cmd_vars(TRUE); reset_cmd_vars(TRUE);
return; return;