From: Pasi Kallinen Date: Tue, 5 Jan 2016 05:42:28 +0000 (+0200) Subject: Finish splitting wallification into two X-Git-Tag: NetHack-3.6.1_RC01~1065^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ece4407c4128b7ead9cd3116c2b300c55c610ad6;p=nethack Finish splitting wallification into two --- diff --git a/src/mkmaze.c b/src/mkmaze.c index 100b0b525..f192a3f3c 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -123,13 +123,9 @@ int wall_there, dx, dy; return spine; } -/* - * Wall cleanup. This function has two purposes: (1) remove walls that - * are totally surrounded by stone - they are redundant. (2) correct - * the types so that they extend and connect to each other. - */ +/* Remove walls totally surrounded by stone */ void -wallification(x1, y1, x2, y2) +wall_cleanup(x1, y1, x2, y2) int x1, y1, x2, y2; { uchar type; @@ -138,9 +134,9 @@ int x1, y1, x2, y2; /* sanity check on incoming variables */ if (x1 < 0 || x2 >= COLNO || x1 > x2 || y1 < 0 || y2 >= ROWNO || y1 > y2) - panic("wallification: bad bounds (%d,%d) to (%d,%d)", x1, y1, x2, y2); + panic("wall_cleanup: bad bounds (%d,%d) to (%d,%d)", x1, y1, x2, y2); - /* Step 1: change walls surrounded by rock to rock. */ + /* change walls surrounded by rock to rock. */ for (x = x1; x <= x2; x++) for (y = y1; y <= y2; y++) { lev = &levl[x][y]; @@ -153,10 +149,9 @@ int x1, y1, x2, y2; lev->typ = STONE; } } - - fix_wall_spines(x1,y1,x2,y2); } +/* Correct wall types so they extend and connect to each other */ void fix_wall_spines(x1, y1, x2, y2) int x1, y1, x2, y2; @@ -181,11 +176,7 @@ int x1, y1, x2, y2; if (x1<0 || x2>=COLNO || x1>x2 || y1<0 || y2>=ROWNO || y1>y2) panic("wall_extends: bad bounds (%d,%d) to (%d,%d)",x1,y1,x2,y2); - /* - * Step 2: set the correct wall type. We can't combine steps - * 1 and 2 into a single sweep because we depend on knowing if - * the surrounding positions are stone. - */ + /* set the correct wall type. */ for (x = x1; x <= x2; x++) for (y = y1; y <= y2; y++) { lev = &levl[x][y]; @@ -217,6 +208,14 @@ int x1, y1, x2, y2; } } +void +wallification(x1, y1, x2, y2) +int x1, y1, x2, y2; +{ + wall_cleanup(x1,y1,x2,y2); + fix_wall_spines(x1,y1,x2,y2); +} + STATIC_OVL boolean okay(x, y, dir) int x, y;