From: Pasi Kallinen Date: Tue, 10 Mar 2020 16:08:40 +0000 (+0200) Subject: Make sure random doors don't open into solid wall X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae471e71b2d9a9937c8b895c7843cf6ee871ac81;p=nethack Make sure random doors don't open into solid wall 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 977cefcc5..21662d901 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/sp_lev.c b/src/sp_lev.c index c0f5259e1..c2092ff93 100755 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -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: