From dc9d0e279fa19943fb54a8b85dcf48ea5905ce5e Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 30 Jun 2024 17:33:41 -0700 Subject: [PATCH] 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. --- src/cmd.c | 108 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 51 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index ae3b325ae..dd1d40fe6 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1771,7 +1771,7 @@ struct ext_func_tab extcmdlist[] = { doputon, 0, NULL }, { 'q', "quaff", "quaff (drink) something", dodrink, CMD_M_PREFIX, NULL }, - { '\0', "quit", "exit without saving current game", + { '\0', "quit", "exit without saving current game", done2, IFBURIED | AUTOCOMPLETE | GENERALCMD | NOFUZZERCMD, NULL }, { 'Q', "quiver", "select ammunition for quiver", @@ -1820,7 +1820,8 @@ struct ext_func_tab extcmdlist[] = { doprtool, IFBURIED | CMD_M_PREFIX, NULL }, { WEAPON_SYM, "seeweapon", "show the weapon currently wielded", 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 #ifndef SHELL | CMD_NOT_AVAILABLE @@ -1959,56 +1960,56 @@ struct ext_func_tab extcmdlist[] = { dozap, 0, NULL }, /* movement commands will be bound by reset_commands() */ /* move or attack; accept m/g/G/F prefixes */ - { '\0', "movewest", "move west (screen left)", - do_move_west, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, - { '\0', "movenorthwest", "move northwest (screen upper left)", - do_move_northwest, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, - { '\0', "movenorth", "move north (screen up)", - do_move_north, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, - { '\0', "movenortheast", "move northeast (screen upper right)", - do_move_northeast, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, - { '\0', "moveeast", "move east (screen right)", - do_move_east, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, - { '\0', "movesoutheast", "move southeast (screen lower right)", - do_move_southeast, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, - { '\0', "movesouth", "move south (screen down)", - do_move_south, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, - { '\0', "movesouthwest", "move southwest (screen lower left)", - do_move_southwest, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "movewest", "move west (screen left)", + do_move_west, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "movenorthwest", "move northwest (screen upper left)", + do_move_northwest, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "movenorth", "move north (screen up)", + do_move_north, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "movenortheast", "move northeast (screen upper right)", + do_move_northeast, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "moveeast", "move east (screen right)", + do_move_east, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "movesoutheast", "move southeast (screen lower right)", + do_move_southeast, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "movesouth", "move south (screen down)", + do_move_south, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, + { '\0', "movesouthwest", "move southwest (screen lower left)", + do_move_southwest, MOVEMENTCMD | CMD_MOVE_PREFIXES, NULL }, /* rush; accept m prefix but not g/G/F */ - { '\0', "rushwest", "rush west (screen left)", - do_rush_west, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "rushnorthwest", "rush northwest (screen upper left)", - do_rush_northwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "rushnorth", "rush north (screen up)", - do_rush_north, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "rushnortheast", "rush northeast (screen upper right)", - do_rush_northeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "rusheast", "rush east (screen right)", - do_rush_east, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "rushsoutheast", "rush southeast (screen lower right)", - do_rush_southeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "rushsouth", "rush south (screen down)", - do_rush_south, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "rushsouthwest", "rush southwest (screen lower left)", - do_rush_southwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rushwest", "rush west (screen left)", + do_rush_west, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rushnorthwest", "rush northwest (screen upper left)", + do_rush_northwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rushnorth", "rush north (screen up)", + do_rush_north, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rushnortheast", "rush northeast (screen upper right)", + do_rush_northeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rusheast", "rush east (screen right)", + do_rush_east, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rushsoutheast", "rush southeast (screen lower right)", + do_rush_southeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rushsouth", "rush south (screen down)", + do_rush_south, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "rushsouthwest", "rush southwest (screen lower left)", + do_rush_southwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, /* run; accept m prefix but not g/G/F */ - { '\0', "runwest", "run west (screen left)", - do_run_west, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "runnorthwest", "run northwest (screen upper left)", - do_run_northwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "runnorth", "run north (screen up)", - do_run_north, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "runnortheast", "run northeast (screen upper right)", - do_run_northeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "runeast", "run east (screen right)", - do_run_east, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "runsoutheast", "run southeast (screen lower right)", - do_run_southeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "runsouth", "run south (screen down)", - do_run_south, MOVEMENTCMD | CMD_M_PREFIX, NULL }, - { '\0', "runsouthwest", "run southwest (screen lower left)", - do_run_southwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runwest", "run west (screen left)", + do_run_west, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runnorthwest", "run northwest (screen upper left)", + do_run_northwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runnorth", "run north (screen up)", + do_run_north, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runnortheast", "run northeast (screen upper right)", + do_run_northeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runeast", "run east (screen right)", + do_run_east, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runsoutheast", "run southeast (screen lower right)", + do_run_southeast, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runsouth", "run south (screen down)", + do_run_south, MOVEMENTCMD | CMD_M_PREFIX, NULL }, + { '\0', "runsouthwest", "run southwest (screen lower left)", + do_run_southwest, MOVEMENTCMD | CMD_M_PREFIX, NULL }, /* internal commands: only used by game core, not available for user */ { '\0', "clicklook", NULL, doclicklook, INTERNALCMD | MOUSECMD, NULL }, @@ -3316,7 +3317,12 @@ rhack(int key) /* if there's no command, there's nothing to do except reset */ if (!key || key == (char) 0377 || 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(); reset_cmd_vars(TRUE); return;