]> granicus.if.org Git - nethack/commitdiff
Finish splitting wallification into two
authorPasi Kallinen <paxed@alt.org>
Tue, 5 Jan 2016 05:42:28 +0000 (07:42 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 5 Jan 2016 05:42:28 +0000 (07:42 +0200)
src/mkmaze.c

index 100b0b5251b75f4d41f718cddf28ed842cab6191..f192a3f3cdfd481ef5bb8626f4536050d5c12f6f 100644 (file)
@@ -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;