]> granicus.if.org Git - nethack/commitdiff
Make sure random doors don't open into solid wall
authorPasi Kallinen <paxed@alt.org>
Tue, 10 Mar 2020 16:08:40 +0000 (18:08 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 10 Mar 2020 16:11:30 +0000 (18:11 +0200)
When making a random door into a random wall or random position
in a room, keep trying harder to find a location that doesn't
have solid wall behind it.

Fixes the Wizard tower door.

doc/fixes37.0
src/sp_lev.c

index 977cefcc52e01b470964e471fea54316111f5fee..21662d901814973bf3b4c90081b2bb87fa9df111 100644 (file)
@@ -109,6 +109,7 @@ reinstate ranked ordering of the status condition fields
 grammar for messages about a monster removing items from a container was bad
 some new status conditions didn't always update when they should
 fix flipping non-existent stairs and ladders (github #311)
+fix door created into random wall or position opening into solid wall
 
 
 Platform- and/or Interface-Specific Fixes
index c0f5259e16de509c12f72335772de8a77c9e721e..c2092ff93561711d8af72d3bd86368ae2d7cb719 100755 (executable)
@@ -1503,7 +1503,7 @@ struct mkroom *broom;
             y = broom->ly - 1;
             x = broom->lx
                 + ((dpos == -1) ? rn2(1 + (broom->hx - broom->lx)) : dpos);
-            if (!isok(x,y - 1))
+            if (!isok(x,y - 1) || IS_ROCK(levl[x][y - 1].typ))
                 goto redoloop;
             goto outdirloop;
         case 1:
@@ -1512,7 +1512,7 @@ struct mkroom *broom;
             y = broom->hy + 1;
             x = broom->lx
                 + ((dpos == -1) ? rn2(1 + (broom->hx - broom->lx)) : dpos);
-            if (!isok(x,y + 1))
+            if (!isok(x,y + 1) || IS_ROCK(levl[x][y + 1].typ))
                 goto redoloop;
             goto outdirloop;
         case 2:
@@ -1521,7 +1521,7 @@ struct mkroom *broom;
             x = broom->lx - 1;
             y = broom->ly
                 + ((dpos == -1) ? rn2(1 + (broom->hy - broom->ly)) : dpos);
-            if (!isok(x - 1,y))
+            if (!isok(x - 1,y) || IS_ROCK(levl[x - 1][y].typ))
                 goto redoloop;
             goto outdirloop;
         case 3:
@@ -1530,7 +1530,7 @@ struct mkroom *broom;
             x = broom->hx + 1;
             y = broom->ly
                 + ((dpos == -1) ? rn2(1 + (broom->hy - broom->ly)) : dpos);
-            if (!isok(x + 1,y))
+            if (!isok(x + 1,y) || IS_ROCK(levl[x + 1][y].typ))
                 goto redoloop;
             goto outdirloop;
         default: