edge of map feedback

When testing Planes of Air and Water, I found it odd that trying to
move off the edge of a level uses a turn but provides no feedback.
If 'mention_walls' is On, report that you can't go any farther in
whichever direction you're trying to move.  Moving diagonally is
only blocked in one of the two combined directions unless you're in
the very corner, so if you try to move southwest while in the middle
of the bottom row, for instance, it says you can't go farther south
rather than southwest.
This commit is contained in:
PatR
2019-05-31 07:35:37 -07:00
parent 48cd573e32
commit a09973851e
2 changed files with 21 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.28 $ $NHDT-Date: 1559299314 2019/05/31 10:41:54 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.29 $ $NHDT-Date: 1559313320 2019/05/31 14:35:20 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -75,6 +75,8 @@ General New Features
--------------------
classify sources as released, beta, or work-in-progress via NH_DEVEL_STATUS
rather than just released vs beta via BETA
if you reach the edge of a level (relatively uncommon) and try to move off,
report that you can't go farther if the 'mention_walls' option is set
NetHack Community Patches (or Variation) Included

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 hack.c $NHDT-Date: 1551137618 2019/02/25 23:33:38 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.208 $ */
/* NetHack 3.6 hack.c $NHDT-Date: 1559313320 2019/05/31 14:35:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.212 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1158,6 +1158,7 @@ int x,y;
int ty = u.ty;
boolean ret;
int g = glyph_at(x,y);
if (x == u.ux && y == u.uy)
return TRUE;
if (isok(x,y) && glyph_is_cmap(g) && S_stone == glyph_to_cmap(g)
@@ -1458,6 +1459,21 @@ domove_core()
}
}
if (!isok(x, y)) {
if (iflags.mention_walls) {
int dx = u.dx, dy = u.dy;
if (dx && dy) { /* diagonal */
/* only as far as possible diagonally if in very
corner; otherwise just report whichever of the
cardinal directions has reached its limit */
if (isok(x, u.uy))
dx = 0;
else if (isok(u.ux, y))
dy = 0;
}
You("have already gone as far %s as possible.",
directionname(xytod(dx, dy)));
}
nomul(0);
return;
}
@@ -2720,6 +2736,7 @@ lookaround()
if (x == u.ux + u.dx && y == u.uy + u.dy) {
if (iflags.mention_walls) {
int tt = what_trap(trap->ttyp, rn2_on_display_rng);
You("stop in front of %s.",
an(defsyms[trap_to_defsym(tt)].explanation));
}