fix bz60 and bz61 - meta char feedback
60: getpos() doesn't report the offending keystroke accurately when rejecting M-something as a movement keystroke while moving the cursor; 61: typing M-N as a command keystroke produces |Unknown command 'M- | '. where the '.' on the second line clobbers the top line of the map. I can't reproduce the first one without extending the altmeta hack [a run-time option to treat two char sequence ESC c as M-c] to getpos() and nh_poskey(), which I've done for testing but am not including here. I can't reproduce the second as it's described, but M-^J produces |Unknown command 'M- |'.--More-- and this fixes that, with a general fix that applies to any meta char. The diffs include some cleanup/groundwork for maybe extending altmeta.
This commit is contained in:
@@ -29,10 +29,14 @@ negative intrinsic protection shouldn't confer MC=1, "you are warded" (not
|
||||
make a slight adjustment to the quickmimic() sense wording
|
||||
fix typo in passage 1 of The Colour of Magic
|
||||
falling asleep when reading dull spellbook ignored sleep resistance
|
||||
getpos() complaint about invalid movement keystroke didn't describe meta-chars
|
||||
accurately
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
-----------------------------------------
|
||||
tty: M-N gave "Unknown command 'M-" with "'." finishing the sentence on the
|
||||
line below it, leaving bogus '.' displayed on the top row of the map
|
||||
unix/X11: in top level Makefile, some commented out definitions of VARDATND
|
||||
misspelled pilemark.xbm (as pilemark.xpm)
|
||||
win32gui: getversionstring() was overflowing the provided Help About buffer
|
||||
|
||||
56
src/cmd.c
56
src/cmd.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 cmd.c $NHDT-Date: 1449736557 2015/12/10 08:35:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.208 $ */
|
||||
/* NetHack 3.6 cmd.c $NHDT-Date: 1450178549 2015/12/15 11:22:29 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.209 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -107,7 +107,7 @@ extern int NDECL(dowield); /**/
|
||||
extern int NDECL(dowieldquiver); /**/
|
||||
extern int NDECL(dozap); /**/
|
||||
extern int NDECL(doorganize); /**/
|
||||
#endif /* DUMB */
|
||||
#endif /* DUMB */
|
||||
|
||||
static int NDECL(dosuspend_core); /**/
|
||||
|
||||
@@ -3402,15 +3402,8 @@ register char *cmd;
|
||||
register const struct func_tab *tlist;
|
||||
int res, NDECL((*func));
|
||||
|
||||
#if 0
|
||||
/* obsolete - scan through the cmdlist array looking for *cmd */
|
||||
for (tlist = cmdlist; tlist->f_char; tlist++) {
|
||||
if ((*cmd & 0xff) != (tlist->f_char & 0xff))
|
||||
continue;
|
||||
#else
|
||||
/* current - use *cmd to directly index cmdlist array */
|
||||
if ((tlist = Cmd.commands[*cmd & 0xff]) != 0) {
|
||||
#endif
|
||||
if (u.uburied && !tlist->can_if_buried) {
|
||||
You_cant("do that while you are buried!");
|
||||
res = 0;
|
||||
@@ -3433,23 +3426,13 @@ register char *cmd;
|
||||
}
|
||||
|
||||
if (bad_command) {
|
||||
char expcmd[10];
|
||||
register char c, *cp = expcmd;
|
||||
char expcmd[20]; /* we expect 'cmd' to point to 1 or 2 chars */
|
||||
register char c;
|
||||
|
||||
expcmd[0] = '\0';
|
||||
while ((c = *cmd++) != '\0')
|
||||
Strcat(expcmd, visctrl(c)); /* add 1..4 chars plus terminator */
|
||||
|
||||
while ((c = *cmd++) != '\0'
|
||||
&& (int) (cp - expcmd) < (int) (sizeof expcmd - 3)) {
|
||||
if (c >= 040 && c < 0177) {
|
||||
*cp++ = c;
|
||||
} else if (c & 0200) {
|
||||
*cp++ = 'M';
|
||||
*cp++ = '-';
|
||||
*cp++ = c & ~0200;
|
||||
} else {
|
||||
*cp++ = '^';
|
||||
*cp++ = c ^ 0100;
|
||||
}
|
||||
}
|
||||
*cp = '\0';
|
||||
if (!prefix_seen || !iflags.cmdassist
|
||||
|| !help_dir(0, "Invalid direction key!"))
|
||||
Norep("Unknown command '%s'.", expcmd);
|
||||
@@ -3587,10 +3570,9 @@ retry:
|
||||
if (!index(quitchars, dirsym)) {
|
||||
help_requested = (dirsym == '?');
|
||||
if (help_requested || iflags.cmdassist) {
|
||||
did_help =
|
||||
help_dir((s && *s == '^') ? dirsym : 0,
|
||||
help_requested ? (const char *) 0
|
||||
: "Invalid direction key!");
|
||||
did_help = help_dir((s && *s == '^') ? dirsym : 0,
|
||||
help_requested ? (const char *) 0
|
||||
: "Invalid direction key!");
|
||||
if (help_requested)
|
||||
goto retry;
|
||||
}
|
||||
@@ -4121,14 +4103,14 @@ char def;
|
||||
iflags.last_msg = PLNMSG_UNKNOWN; /* most recent pline is clobbered */
|
||||
|
||||
/* maximum acceptable length is QBUFSZ-1 */
|
||||
if (strlen(query) < QBUFSZ)
|
||||
return (*windowprocs.win_yn_function)(query, resp, def);
|
||||
|
||||
/* caller shouldn't have passed anything this long */
|
||||
paniclog("Query truncated: ", query);
|
||||
(void) strncpy(qbuf, query, QBUFSZ - 1 - 3);
|
||||
Strcpy(&qbuf[QBUFSZ - 1 - 3], "...");
|
||||
return (*windowprocs.win_yn_function)(qbuf, resp, def);
|
||||
if (strlen(query) >= QBUFSZ) {
|
||||
/* caller shouldn't have passed anything this long */
|
||||
paniclog("Query truncated: ", query);
|
||||
(void) strncpy(qbuf, query, QBUFSZ - 1 - 3);
|
||||
Strcpy(&qbuf[QBUFSZ - 1 - 3], "...");
|
||||
query = qbuf;
|
||||
}
|
||||
return (*windowprocs.win_yn_function)(query, resp, def);
|
||||
}
|
||||
|
||||
/* for paranoid_confirm:quit,die,attack prompting */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 do_name.c $NHDT-Date: 1449982602 2015/12/13 04:56:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.79 $ */
|
||||
/* NetHack 3.6 do_name.c $NHDT-Date: 1450178550 2015/12/15 11:22:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.80 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -54,7 +54,7 @@ const char *goal;
|
||||
putstr(tmpwin, 0, "Use [HJKL] to move the cursor 8 units at a time.");
|
||||
putstr(tmpwin, 0, "Or enter a background symbol (ex. <).");
|
||||
putstr(tmpwin, 0, "Use @ to move the cursor on yourself.");
|
||||
if (getpos_hilitefunc != NULL)
|
||||
if (getpos_hilitefunc)
|
||||
putstr(tmpwin, 0, "Use $ to display valid locations.");
|
||||
putstr(tmpwin, 0, "Use # to toggle automatic description.");
|
||||
/* disgusting hack; the alternate selection characters work for any
|
||||
@@ -197,7 +197,7 @@ const char *goal;
|
||||
/* update message window to reflect that we're still targetting */
|
||||
show_goal_msg = TRUE;
|
||||
msg_given = TRUE;
|
||||
} else if ((c == '$') && (getpos_hilitefunc != NULL)) {
|
||||
} else if (c == '$' && getpos_hilitefunc) {
|
||||
if (!hilite_state) {
|
||||
(*getpos_hilitefunc)(0);
|
||||
(*getpos_hilitefunc)(1);
|
||||
@@ -307,7 +307,7 @@ const char *goal;
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
ccp->x = cx;
|
||||
ccp->y = cy;
|
||||
getpos_hilitefunc = NULL;
|
||||
getpos_hilitefunc = (void FDECL((*), (int))) 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 hacklib.c $NHDT-Date: 1446336792 2015/11/01 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
|
||||
/* NetHack 3.6 hacklib.c $NHDT-Date: 1450178551 2015/12/15 11:22:31 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.46 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* Copyright (c) Robert Patrick Rankin, 1991 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -373,20 +373,24 @@ char *
|
||||
visctrl(c)
|
||||
char c;
|
||||
{
|
||||
Static char ccc[3];
|
||||
Static char ccc[5];
|
||||
register int i = 0;
|
||||
|
||||
c &= 0177;
|
||||
ccc[2] = '\0';
|
||||
if (c < 040) {
|
||||
ccc[0] = '^';
|
||||
ccc[1] = c | 0100; /* letter */
|
||||
} else if (c == 0177) {
|
||||
ccc[0] = '^';
|
||||
ccc[1] = c & ~0100; /* '?' */
|
||||
} else {
|
||||
ccc[0] = c; /* printable character */
|
||||
ccc[1] = '\0';
|
||||
if ((uchar) c & 0200) {
|
||||
ccc[i++] = 'M';
|
||||
ccc[i++] = '-';
|
||||
}
|
||||
c &= 0177;
|
||||
if (c < 040) {
|
||||
ccc[i++] = '^';
|
||||
ccc[i++] = c | 0100; /* letter */
|
||||
} else if (c == 0177) {
|
||||
ccc[i++] = '^';
|
||||
ccc[i++] = c & ~0100; /* '?' */
|
||||
} else {
|
||||
ccc[i++] = c; /* printable character */
|
||||
}
|
||||
ccc[i] = '\0';
|
||||
return ccc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user