From 36d8998edb7600b12d450fe9c3e649c88fd17e01 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 9 Nov 2024 11:40:09 -0500 Subject: [PATCH] try not including trees when check_pos() returns it's 3rd argument. Related to #1309 https://github.com/NetHack/NetHack/issues/1309 K2 commented: "This might help - k21971/EvilHack@afed641" A comment in there states: "Fix: sections of wall being visible when they shouldn't yet. This has been a long-standing bug for as long as I can remember, and qt appears to have figured it out. What was happening: the player would all of the sudden see a section of wall in an area that they hadn't explored yet. It was discovered that this was only occurring if that section of wall had any type of tree up against it." The fix there attempts to leave trees out of the check_pos non-zero return, so give that a shot. I didn't attempt to reproduce the situation myself, and therefore cannot confirm that this does resolve it. Feedback on effectiveness or side-effects are welcomed. If someone is able to confirm that this resolves the issue without creating new issues, we can close it, otherwise this can be reverted. --- include/rm.h | 2 ++ src/display.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/rm.h b/include/rm.h index 14005d90a..060a1c22f 100644 --- a/include/rm.h +++ b/include/rm.h @@ -104,6 +104,8 @@ enum levl_typ_types { #define IS_WALL(typ) ((typ) && (typ) <= DBWALL) #define IS_STWALL(typ) ((typ) <= DBWALL) /* STONE <= (typ) <= DBWALL */ #define IS_OBSTRUCTED(typ) ((typ) < POOL) /* absolutely nonaccessible */ +#define IS_CORR(typ) ((typ) == CORR || (typ) == SCORR) +#define IS_SDOOR(typ) ((typ) == SDOOR) #define IS_DOOR(typ) ((typ) == DOOR) #define IS_DOORJOIN(typ) (IS_OBSTRUCTED(typ) || (typ) == IRONBARS) #define IS_TREE(typ) \ diff --git a/src/display.c b/src/display.c index 30eb249dd..c379331e5 100644 --- a/src/display.c +++ b/src/display.c @@ -3101,7 +3101,7 @@ check_pos(coordxy x, coordxy y, int which) if (!isok(x, y)) return which; type = levl[x][y].typ; - if (IS_OBSTRUCTED(type) || type == CORR || type == SCORR) + if (IS_STWALL(type) || IS_CORR(type) || IS_SDOOR(type)) return which; return 0; }