]> granicus.if.org Git - nethack/commitdiff
Split wallification into two by function
authorPasi Kallinen <paxed@alt.org>
Sat, 2 Jan 2016 22:36:36 +0000 (00:36 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 2 Jan 2016 22:36:36 +0000 (00:36 +0200)
include/extern.h
src/mkmaze.c

index c25c634b663aa41dbab48d622a656d797a24a804..3bba9fe1dff53a2fbccb970cc9ba7a36b58c4fe2 100644 (file)
@@ -1190,6 +1190,7 @@ E void FDECL(remove_rooms, (int, int, int, int));
 /* ### mkmaze.c ### */
 
 E void FDECL(wallification, (int, int, int, int));
+E void FDECL(fix_wall_spines, (int, int, int, int));
 E void FDECL(walkfrom, (int, int, SCHAR_P));
 E void FDECL(makemaz, (const char *));
 E void FDECL(mazexy, (coord *));
index eddf6fbd1a7e39065b0f0b848da49c853f3641a6..100b0b5251b75f4d41f718cddf28ed842cab6191 100644 (file)
@@ -135,17 +135,6 @@ int x1, y1, x2, y2;
     uchar type;
     register int x, y;
     struct rm *lev;
-    int bits;
-    int locale[3][3]; /* rock or wall status surrounding positions */
-    /*
-     * Value 0 represents a free-standing wall.  It could be anything,
-     * so even though this table says VWALL, we actually leave whatever
-     * typ was there alone.
-     */
-    static xchar spine_array[16] = { VWALL, HWALL,    HWALL,    HWALL,
-                                     VWALL, TRCORNER, TLCORNER, TDWALL,
-                                     VWALL, BRCORNER, BLCORNER, TUWALL,
-                                     VWALL, TLWALL,   TRWALL,   CROSSWALL };
 
     /* sanity check on incoming variables */
     if (x1 < 0 || x2 >= COLNO || x1 > x2 || y1 < 0 || y2 >= ROWNO || y1 > y2)
@@ -165,6 +154,33 @@ int x1, y1, x2, y2;
             }
         }
 
+    fix_wall_spines(x1,y1,x2,y2);
+}
+
+void
+fix_wall_spines(x1, y1, x2, y2)
+int x1, y1, x2, y2;
+{
+    uchar type;
+    register int x,y;
+    struct rm *lev;
+    int bits;
+    int locale[3][3];  /* rock or wall status surrounding positions */
+
+    /*
+     * Value 0 represents a free-standing wall.  It could be anything,
+     * so even though this table says VWALL, we actually leave whatever
+     * typ was there alone.
+     */
+    static xchar spine_array[16] = { VWALL, HWALL,    HWALL,    HWALL,
+                                     VWALL, TRCORNER, TLCORNER, TDWALL,
+                                     VWALL, BRCORNER, BLCORNER, TUWALL,
+                                     VWALL, TLWALL,   TRWALL,   CROSSWALL };
+
+    /* sanity check on incoming variables */
+    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