From a09973851ee3bc4805a855bce74ae2ca96b9f372 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 31 May 2019 07:35:37 -0700 Subject: [PATCH] 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. --- doc/fixes36.3 | 4 +++- src/hack.c | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index fbb80dd07..83199ee84 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -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 diff --git a/src/hack.c b/src/hack.c index 6f2489197..7c80a8c1e 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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)); } -- 2.40.0