fix #K3577 - F+dir followed by ^A moved dir

Reported by luxidream via the web contact form and also as github
issue #732: using the repeat command after F+direction would take a
step in direction if there was no target to fight.

The direction was being repeated without the F prefix.  It wasn't
specific to F; m+dir misbehaved too.  This fix seems to work but it
should be replaced with something more robust.

Fixes #732
This commit is contained in:
PatR
2022-04-14 18:59:23 -07:00
parent 554ebc0f4c
commit da35dfe48e
2 changed files with 16 additions and 9 deletions

View File

@@ -1149,6 +1149,8 @@ sequencing confusion: picking an item when viewing inventory and picking an
program would access freed memory if charging caused a ring to explode
arriving on Valkyrie quest final level could produce impossible warning
"mkstairs: placing stairs up on molten lava at <68,13>"
if the repeat command was used after prefix+command, only the command part got
repeated
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -4261,10 +4261,10 @@ getdir(const char *s)
}
static void
show_direction_keys(winid win, /* should specify a window which is
* using a fixed-width font... */
char centerchar, /* '.' or '@' or ' ' */
boolean nodiag)
show_direction_keys(
winid win, /* should specify a window which is using a fixed-width font */
char centerchar, /* '.' or '@' or ' ' */
boolean nodiag)
{
char buf[BUFSZ];
@@ -5159,12 +5159,16 @@ parse(void)
} else if (g.in_doagain) {
g.command_count = g.last_command_count;
} else if (foo && foo == cmd_from_func(do_repeat)) {
// g.command_count will be set again when we
// re-enter with g.in_doagain set true
/* g.command_count will be set again when we
re-enter with g.in_doagain set true */
g.command_count = g.last_command_count;
} else {
uchar c = (g.shead > 0) ? (uchar) g.saveq[g.shead - 1] & 0xff : 0;
g.last_command_count = g.command_count;
savech(0); /* reset input queue */
/* reset saveq unless it holds a prefix */
if (!c || (g.Cmd.commands[c]->flags & PREFIXCMD) == 0)
savech(0);
savech((char) foo);
}
@@ -5186,8 +5190,9 @@ parse(void)
the return value so we should be safe using `void' unconditionally */
/*ARGUSED*/
void
hangup(int sig_unused UNUSED) /* called as signal() handler, so sent
at least one arg */
hangup(
int sig_unused UNUSED) /* called as signal() handler, so sent
* at least one arg */
{
if (g.program_state.exiting)
g.program_state.in_moveloop = 0;