diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 3217305a2..a49b10eb4 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -302,6 +302,8 @@ when dipping something in holy/unholy water, only learn its new bless/curse state if hero sees it glow describe lit Sunsword as shining rather than glowing prevent poly'd shopkeepers from taking on forms that can't handle objects +attempting to move direction 'u' as a grid bug performed #untrap command; + the other diagonals reported "unknown command" instead of "you can't" Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index cda31de6e..809c2e400 100644 --- a/include/extern.h +++ b/include/extern.h @@ -200,6 +200,7 @@ E void FDECL(show_conduct, (int)); E int FDECL(xytod, (SCHAR_P,SCHAR_P)); E void FDECL(dtoxy, (coord *,int)); E int FDECL(movecmd, (CHAR_P)); +E int NDECL(dxdy_moveok); E int FDECL(getdir, (const char *)); E void NDECL(confdir); E const char *FDECL(directionname, (int)); diff --git a/src/cmd.c b/src/cmd.c index a1499ccaf..fb8a10a51 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)cmd.c 3.5 2008/05/25 */ +/* SCCS Id: @(#)cmd.c 3.5 2009/01/28 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2855,6 +2855,20 @@ register char *cmd; } } + if ((do_walk || do_rush) && !context.travel && !dxdy_moveok()) { + /* trying to move diagonally as a grid bug; + this used to be treated by movecmd() as not being + a movement attempt, but that didn't provide for any + feedback and led to strangeness if the key pressed + ('u' in particular) was overloaded for num_pad use */ + You_cant("get there from here..."); + context.run = 0; + context.nopick = context.forcefight = FALSE; + context.move = context.mv = FALSE; + multi = 0; + return; + } + if (do_walk) { if (multi) context.mv = TRUE; domove(); @@ -2968,13 +2982,23 @@ char sym; u.dx = xdir[dp - Cmd.dirchars]; u.dy = ydir[dp - Cmd.dirchars]; u.dz = zdir[dp - Cmd.dirchars]; +#if 0 /* now handled elsewhere */ if (u.dx && u.dy && NODIAG(u.umonnum)) { u.dx = u.dy = 0; return 0; } +#endif return !u.dz; } +/* grid bug handling which used to be in movecmd() */ +int +dxdy_moveok() +{ + if (u.dx && u.dy && NODIAG(u.umonnum)) u.dx = u.dy = 0; + return u.dx || u.dy; +} + /* decide whether a character (user input keystroke) requests screen repaint */ boolean redraw_cmd(c) @@ -3020,6 +3044,7 @@ getdir(s) const char *s; { char dirsym; + int is_mov; retry: #ifdef REDO @@ -3042,7 +3067,7 @@ const char *s; if (dirsym == '.' || dirsym == 's') { u.dx = u.dy = u.dz = 0; - } else if (!movecmd(dirsym) && !u.dz) { + } else if (!(is_mov = movecmd(dirsym)) && !u.dz) { boolean did_help = FALSE, help_requested; if (!index(quitchars, dirsym)) { @@ -3056,6 +3081,9 @@ const char *s; if (!did_help) pline("What a strange direction!"); } return 0; + } else if (is_mov && !dxdy_moveok()) { + You_cant("orient yourself that direction."); + return 0; } if (!u.dz && (Stunned || (Confusion && !rn2(5)))) confdir(); return 1; diff --git a/src/dig.c b/src/dig.c index c565918d0..e69c4ac19 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)dig.c 3.5 2007/04/02 */ +/* SCCS Id: @(#)dig.c 3.5 2009/01/28 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -916,7 +916,7 @@ struct obj *obj; register char *dsp = dirsyms; register int rx, ry; int res = 0; - const char *sdp = Cmd.dirchars, *verb; + const char *sdp, *verb; /* Check tool */ if (obj != uwep) { @@ -934,8 +934,9 @@ struct obj *obj; return res; } - while(*sdp) { + for (sdp = Cmd.dirchars; *sdp; ++sdp) { (void) movecmd(*sdp); /* sets u.dx and u.dy and u.dz */ + if (!u.dz && !dxdy_moveok()) continue; /* handle NODIAG */ rx = u.ux + u.dx; ry = u.uy + u.dy; /* Include down even with axe, so we have at least one direction */ @@ -943,7 +944,6 @@ struct obj *obj; (u.dz == 0 && isok(rx, ry) && dig_typ(obj, rx, ry) != DIGTYP_UNDIGGABLE)) *dsp++ = *sdp; - sdp++; } *dsp = 0; Sprintf(qbuf, "In what direction do you want to %s? [%s]", verb, dirsyms);