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:
15
src/mdlib.c
15
src/mdlib.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 mdlib.c $NHDT-Date: 1596567095 2020/08/04 18:51:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.10 $ */
|
||||
/* NetHack 3.7 mdlib.c $NHDT-Date: 1608933420 2020/12/25 21:57:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.17 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
|
||||
/* Copyright (c) M. Stephenson, 1990, 1991. */
|
||||
@@ -478,6 +478,13 @@ static const char *build_opts[] = {
|
||||
#if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__))
|
||||
"external program as a message handler",
|
||||
#endif
|
||||
#if defined(HANGUPHANDLING) && !defined(NO_SIGNAL)
|
||||
#ifdef SAFERHANGUP
|
||||
"deferred handling of hangup signal",
|
||||
#else
|
||||
"immediate handling of hangup signal",
|
||||
#endif
|
||||
#endif
|
||||
#ifdef INSURANCE
|
||||
"insurance files for recovering from crashes",
|
||||
#endif
|
||||
@@ -709,9 +716,9 @@ build_options()
|
||||
continue;
|
||||
#endif
|
||||
#endif /* !MAKEDEFS_C && FOR_RUNTIME */
|
||||
opt_out_words(strcat(strcpy(buf, build_opts[i]),
|
||||
(i < SIZE(build_opts) - 1) ? "," : "."),
|
||||
&length);
|
||||
Strcat(strcpy(buf, build_opts[i]),
|
||||
(i < SIZE(build_opts) - 1) ? "," : ".");
|
||||
opt_out_words(buf, &length);
|
||||
}
|
||||
opttext[idxopttext] = strdup(optbuf);
|
||||
if (idxopttext < (MAXOPT - 1))
|
||||
|
||||
Reference in New Issue
Block a user