diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 69b57c25f..bc886b713 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -576,6 +576,9 @@ try again to fix achievement recording bug with mines and sokoban prizes the fix for secret doors on special levels always having vertical orientation resulted in some--but not all--secret doors within vertical walls being displayed as horizontal walls while still hidden +and the previous fix for the for secret doors didn't work if the level hadn't + been wallified yet (Cav quest) so horizontal wall with secret door + mis-displayed as a vertical wall segment could occur the fix intended for "a shop object stolen from outside the shop (via grappling hook) would be left marked as 'unpaid'" broke normal pickup, preventing any picked up item from merging with compatible stack diff --git a/src/sp_lev.c b/src/sp_lev.c index e2d362c6c..5140dd2da 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sp_lev.c $NHDT-Date: 1514769572 2018/01/01 01:19:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.95 $ */ +/* NetHack 3.6 sp_lev.c $NHDT-Date: 1519399521 2018/02/23 15:25:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.96 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -4207,7 +4207,7 @@ genericptr_t arg; { xchar typ = *(xchar *) arg; xchar x = dx, y = dy; - boolean left_or_right, up_and_down; + boolean wleft, wright, wup, wdown; if (!IS_DOOR(levl[x][y].typ) && levl[x][y].typ != SDOOR) levl[x][y].typ = (typ & D_SECRET) ? SDOOR : DOOR; @@ -4231,21 +4231,31 @@ genericptr_t arg; * * A secret door with no adjacent walls is also feasible and makes * even less sense. It will be displayed as a vertical wall while - * hidden and become a vertical door when found. + * hidden and become a vertical door when found. Before resorting + * to that, we check for solid rock which hasn't been wallified + * yet (cf lower leftside of leader's room in Cav quest). */ - left_or_right = ((isok(x - 1, y) && (IS_WALL(levl[x - 1][y].typ) - || IS_DOOR(levl[x - 1][y].typ) - || levl[x - 1][y].typ == SDOOR)) - || (isok(x + 1, y) && (IS_WALL(levl[x + 1][y].typ) - || IS_DOOR(levl[x + 1][y].typ) - || levl[x + 1][y].typ == SDOOR))); - up_and_down = ((isok(x, y - 1) && (IS_WALL(levl[x][y - 1].typ) - || IS_DOOR(levl[x][y - 1].typ) - || levl[x][y - 1].typ == SDOOR)) - && (isok(x, y + 1) && (IS_WALL(levl[x][y + 1].typ) - || IS_DOOR(levl[x][y + 1].typ) - || levl[x][y + 1].typ == SDOOR))); - levl[x][y].horizontal = (left_or_right && !up_and_down) ? 1 : 0; + wleft = (isok(x - 1, y) && (IS_WALL(levl[x - 1][y].typ) + || IS_DOOR(levl[x - 1][y].typ) + || levl[x - 1][y].typ == SDOOR)); + wright = (isok(x + 1, y) && (IS_WALL(levl[x + 1][y].typ) + || IS_DOOR(levl[x + 1][y].typ) + || levl[x + 1][y].typ == SDOOR)); + wup = (isok(x, y - 1) && (IS_WALL(levl[x][y - 1].typ) + || IS_DOOR(levl[x][y - 1].typ) + || levl[x][y - 1].typ == SDOOR)); + wdown = (isok(x, y + 1) && (IS_WALL(levl[x][y + 1].typ) + || IS_DOOR(levl[x][y + 1].typ) + || levl[x][y + 1].typ == SDOOR)); + if (!wleft && !wright && !wup && !wdown) { + /* out of bounds is treated as implicit wall; should be academic + because we don't expect to have doors so near the level's edge */ + wleft = (!isok(x - 1, y) || IS_DOORJOIN(levl[x - 1][y].typ)); + wright = (!isok(x + 1, y) || IS_DOORJOIN(levl[x + 1][y].typ)); + wup = (!isok(x, y - 1) || IS_DOORJOIN(levl[x][y - 1].typ)); + wdown = (!isok(x, y + 1) || IS_DOORJOIN(levl[x][y + 1].typ)); + } + levl[x][y].horizontal = ((wleft || wright) && !(wup && wdown)) ? 1 : 0; levl[x][y].doormask = typ; SpLev_Map[x][y] = 1; }