From 7856f5a5d8c7fec69621d8c6db5ff0fc47269f2b Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 11 Apr 2021 14:13:52 -0700 Subject: [PATCH] tweaks to a few command flags The #twoweapon command was flagged as autocomplete back when using an extended command was the only way to execute it. Take that off since simple 'X' suffices. Do the same for wizard mode commands that can be invoked with control characters. Probably ought to do the same for #overview too but this change doesn't. I started to add the autocomplete flag for #exploremode but that would require an extra letter for #enhance so I decided not to. There are some wizard mode commands that can't be executed under X11 because they aren't flagged to autocomplete and its extended command selection widget only offers autocomplete commands as choices. I haven't attempted to change that. Always require paranoid confirmation for #panic rather than just when it has been enabled for #quit. --- doc/fixes37.0 | 6 +++++- src/cmd.c | 29 +++++++++++++++++++---------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 22bcbecfe..9609a930b 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.498 $ $NHDT-Date: 1617388018 2021/04/02 18:26:58 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.503 $ $NHDT-Date: 1618175625 2021/04/11 21:13:45 $ General Fixes and Modified Features ----------------------------------- @@ -445,6 +445,10 @@ for menustyle:full, the 'A' menu choice to auto-select everything now only using travel to move one step diagonally where that step was blocked by being too narrow to squeeze through stopped travel instead of considering alternate routes to the destination +turn off input autocompletion for '#twoweapon' since simple 'X' invokes it; + likewise for #wizdetect (^E), #wizgenesis (^G), #wizidentify (^I), + #wizlevelport (^V), #wizmap (^F), and #wizwish (^W); probably ought + to do so for #overview (^O) too but that one still autocompletes Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index 0d571c47d..e448cf0aa 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 cmd.c $NHDT-Date: 1613721260 2021/02/19 07:54:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.457 $ */ +/* NetHack 3.7 cmd.c $NHDT-Date: 1618175625 2021/04/11 21:13:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.463 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1140,7 +1140,7 @@ wiz_panic(void) u.uen = u.uenmax = 1000; return 0; } - if (paranoid_query(ParanoidQuit, + if (paranoid_query(TRUE, "Do you want to call panic() and end your game?")) panic("Crash test."); return 0; @@ -1786,7 +1786,11 @@ doterrain(void) return 0; /* no time elapses */ } -/* ordered by command name */ +/* extcmdlist: full command list, ordered by command name; + commands with no keystroke or with only a meta keystroke generally + need to be flagged as autocomplete and ones with a regular keystroke + or control keystroke generally should not be; there are a few exceptions + such as ^O/#overview and C/N/#name */ struct ext_func_tab extcmdlist[] = { { '#', "#", "perform an extended command", doextcmd, IFBURIED | GENERALCMD, NULL }, @@ -1826,6 +1830,8 @@ struct ext_func_tab extcmdlist[] = { doengrave, 0, NULL }, { M('e'), "enhance", "advance or check weapon and spell skills", enhance_weapon_skill, IFBURIED | AUTOCOMPLETE, NULL }, + /* #exploremode should be flagged AUTOCOMPETE but that would negatively + impact frequently used #enhance by making #e become ambiguous */ { M('X'), "exploremode", "enter explore (discovery) mode", enter_explore_mode, IFBURIED | GENERALCMD, NULL }, { 'f', "fire", "fire ammunition from quiver", @@ -1876,8 +1882,11 @@ struct ext_func_tab extcmdlist[] = { doopen, 0, NULL }, { 'O', "options", "show option settings, possibly change them", doset, IFBURIED | GENERALCMD, NULL }, + /* #overview used to need autocomplete and has retained that even + after being assigned to ^O [old wizard mode ^O is now #wizwhere] */ { C('o'), "overview", "show a summary of the explored dungeon", dooverview, IFBURIED | AUTOCOMPLETE, NULL }, + /* [should #panic actually autocomplete?] */ { '\0', "panic", "test panic routine (fatal to game)", wiz_panic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, { 'p', "pay", "pay your shopping bill", @@ -1978,7 +1987,7 @@ struct ext_func_tab extcmdlist[] = { { M('t'), "turn", "turn undead away", doturn, IFBURIED | AUTOCOMPLETE, NULL }, { 'X', "twoweapon", "toggle two-weapon combat", - dotwoweapon, AUTOCOMPLETE, NULL }, + dotwoweapon, 0, NULL }, { M('u'), "untrap", "untrap something", dountrap, AUTOCOMPLETE, NULL }, { '<', "up", "go up a staircase", @@ -2011,17 +2020,17 @@ struct ext_func_tab extcmdlist[] = { wiz_debug_cmd_bury, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, #endif { C('e'), "wizdetect", "reveal hidden things within a small radius", - wiz_detect, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, + wiz_detect, IFBURIED | WIZMODECMD, NULL }, { '\0', "wizfliplevel", "flip the level", wiz_flip_level, IFBURIED | WIZMODECMD, NULL }, { C('g'), "wizgenesis", "create a monster", - wiz_genesis, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, + wiz_genesis, IFBURIED | WIZMODECMD, NULL }, { C('i'), "wizidentify", "identify all items in inventory", - wiz_identify, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, + wiz_identify, IFBURIED | WIZMODECMD, NULL }, { '\0', "wizintrinsic", "set an intrinsic", wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, { C('v'), "wizlevelport", "teleport to another level", - wiz_level_tele, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, + wiz_level_tele, IFBURIED | WIZMODECMD, NULL }, { '\0', "wizloaddes", "load and execute a des-file lua script", wiz_load_splua, IFBURIED | WIZMODECMD, NULL }, { '\0', "wizloadlua", "load and execute a lua script", @@ -2029,7 +2038,7 @@ struct ext_func_tab extcmdlist[] = { { '\0', "wizmakemap", "recreate the current level", wiz_makemap, IFBURIED | WIZMODECMD, NULL }, { C('f'), "wizmap", "map the level", - wiz_map, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, + wiz_map, IFBURIED | WIZMODECMD, NULL }, { '\0', "wizrumorcheck", "verify rumor boundaries", wiz_rumor_check, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, { '\0', "wizseenv", "show map locations' seen vectors", @@ -2039,7 +2048,7 @@ struct ext_func_tab extcmdlist[] = { { '\0', "wizwhere", "show locations of special levels", wiz_where, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, { C('w'), "wizwish", "wish for something", - wiz_wish, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, + wiz_wish, IFBURIED | WIZMODECMD, NULL }, { '\0', "wmode", "show wall modes", wiz_show_wmodes, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, { 'z', "zap", "zap a wand",