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:
19
src/hack.c
19
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user