fix github issue #426 - binding special commands

Binding 'repeat' (DOAGAIN, or redo) to a different key than ^A
didn't work as intended because the code that used it was
checking for DOAGAIN (a key value from config.h) instead of
g.Cmd.spkeys[NHKF_DOAGAIN] (the key currently bound to repeat).

Contrary to the github issue, re-bound prefix keys worked ok for
me if followed by a direction.  However, they behaved strangely
if followed by anything else.  If the keystroke was stolen from
some other command and that command hadn't been bound to another
key, following the prefix with a non-direction could end up
executing the command that used to own the key.  For example,
 BIND=d:nopickup
to use 'd' to move without auto-pickup would work if you used
d<direction> but if you used d<something-else> if would execute
the drop command.

The NHKF_REQMENU prefix could be bound to some key other than
'm' but it only worked as intended if the new key was a movement
prefix.

This also makes DOAGAIN be unconditional.  If it is deleted or
commented out in config.h, the default binding will be '\000' so
unusable (freeing up ^A for something), but still be available
to be bound to some key (perhaps even ^A).

This also includes an unrelated change to mdlib.c.  The comments
added to config.h will force a full rebuild.  Changing mdlib.c
now rather than separately will avoid forcing that twice.

Fixes #426
This commit is contained in:
PatR
2020-12-25 13:57:05 -08:00
parent 1a2afd21d4
commit 0ec355bdb4
5 changed files with 75 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.401 $ $NHDT-Date: 1608846067 2020/12/24 21:41:07 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.402 $ $NHDT-Date: 1608933417 2020/12/25 21:56:57 $
General Fixes and Modified Features
-----------------------------------
@@ -345,6 +345,15 @@ best possible armor class reduced from -127 to -99; worst from +127 to +99;
charged or enchanted individual items also capped at +/- 99 (affects
wizard mode wishing, negligible effect on normal play)
fix several inconsistencies for objects at hole locations
make repeat (^A) work when bound to some other keystroke
if a prefix key was bound to some character which ordinarily ran a regular
command and that command wasn't bound to another key, typing the
prefix followed by a non-movement key behaved strangely: instead
of reporting "invalid direction" it would run the other command
(actually depended upon relative order of prefix's new and old key)
reqmenu (the request-a-menu prefix supported by a handful of non-movement
commands) could be bound to some key other than 'm' but it only
worked if the new key was also a movement prefix
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
@@ -692,6 +701,8 @@ add 'sortdiscoveries' option to control output of '\' and '`' commands
include an indication of monsters' health during farlook feedback (including
/M and autodescribe); also include it in death reason when killed by
a monster: "killed by {an uninjured newt,a heavily injured mumak}"
make DOAGAIN (^A) become unconditional; commenting it out in config.h makes
it be bound to NUL, a no-op, but allows BIND=k:repeat to set it to k
Platform- and/or Interface-Specific New Features