digging prompt: > vs < (trunk only)

The intersection of a couple of recent patches:  noticed when
updating movement as a grid bug, and accentuated when fixing the attempt
to move down while levitating.  If you can't reach the floor due to
levitation, don't show '>' in the list of likely candidate directions for
the prompt when digging.  It was always included so that the list could
never be empty, but it's a poor suggestion to the player when levitating.
Use '<' instead in that situation; also a poor suggestion, but silly
rather than unintentional.  :-)

     This only affects the bracketted part of the "In what direction?"
prompt, not the actual digging (and player can pick any direction whether
it's shown in the prompt or not, so the digging code is already prepared
to handle attempts to dig up as well as down anyway).
This commit is contained in:
nethack.rankin
2009-02-03 03:03:16 +00:00
parent 82ae06c617
commit 817976661f
2 changed files with 28 additions and 14 deletions

View File

@@ -305,6 +305,7 @@ 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"
mimic posing as statue or corpse now picks and maintains particular monst type
when levitating, don't show '>' as a likely direction for digging
Platform- and/or Interface-Specific Fixes

View File

@@ -910,13 +910,10 @@ int
use_pick_axe(obj)
struct obj *obj;
{
boolean ispick;
char dirsyms[12];
char qbuf[QBUFSZ];
register char *dsp = dirsyms;
register int rx, ry;
int res = 0;
const char *sdp, *verb;
char *dsp, dirsyms[12], qbuf[BUFSZ];
boolean ispick;
int rx, ry, downok, res = 0;
/* Check tool */
if (obj != uwep) {
@@ -934,19 +931,35 @@ struct obj *obj;
return res;
}
/* construct list of directions to show player for likely choices */
downok = !!can_reach_floor(FALSE);
dsp = dirsyms;
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 */
/* filter out useless directions */
if (u.uswallow) {
; /* all directions are viable when swallowed */
} else if (movecmd(*sdp)) {
/* normal direction, within plane of the level map;
movecmd() sets u.dx, u.dy, u.dz and returns !u.dz */
if (!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 */
if (u.dz > 0 ||
(u.dz == 0 && isok(rx, ry) &&
dig_typ(obj, rx, ry) != DIGTYP_UNDIGGABLE))
*dsp++ = *sdp;
if (!isok(rx, ry) || dig_typ(obj, rx, ry) == DIGTYP_UNDIGGABLE)
continue;
} else {
/* up or down; we used to always include down, so that
there would always be at least one choice shown, but
it shouldn't be a likely candidate when floating high
above the floor; include up instead in that situation
(as a silly candidate rather than a likely one...) */
if ((u.dz > 0) ^ downok) continue;
}
/* include this direction */
*dsp++ = *sdp;
}
*dsp = 0;
Sprintf(qbuf, "In what direction do you want to %s? [%s]", verb, dirsyms);
Sprintf(qbuf, "In what direction do you want to %s? [%s]",
verb, dirsyms);
if(!getdir(qbuf))
return(res);