]> granicus.if.org Git - nethack/commitdiff
fix "wonky secret door" in Cav quest
authorPatR <rankin@nethack.org>
Fri, 23 Feb 2018 15:25:37 +0000 (07:25 -0800)
committerPatR <rankin@nethack.org>
Fri, 23 Feb 2018 15:25:37 +0000 (07:25 -0800)
The earlier fix for hoizontal vs vertical doors would have worked for
the Cav quest (lower left in leader's chamber) where door handling
occurs before wallification, but it wasn't working for minend-3 (east
wall of entry room) which already had walls.  The more recent fix
solved the second case but broke the first one.  I think this actually
solves both modes of door classification.  I hope....

doc/fixes36.1
src/sp_lev.c

index 69b57c25f929d850d51f43e0f0435e0710ec38c4..bc886b7138288b8a3a36e3c318f7881fef6348f5 100644 (file)
@@ -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
index e2d362c6c2bf5426cb5385363461bc1b1e833c9c..5140dd2dab4963d1e74f8f37f4c41cdd102669ee 100644 (file)
@@ -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;
 }