]> granicus.if.org Git - nethack/commitdiff
Split bound_digging function to two
authorPasi Kallinen <paxed@alt.org>
Tue, 18 Feb 2020 14:53:10 +0000 (16:53 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 18 Feb 2020 14:53:14 +0000 (16:53 +0200)
Also remove a DCC 3.0 specific bug define,
doubt anyone is using that anymore ...

src/mkmaze.c

index d37d1c08c81f7614ae87c6da8beed03da556b6c8..b46185b6b170c9a3012df3f0b40925852a110f62 100644 (file)
@@ -22,6 +22,7 @@ static void FDECL(check_ransacked, (char *));
 static void FDECL(migr_booty_item, (int, const char *));
 static void FDECL(migrate_orc, (struct monst *, unsigned long));
 static void NDECL(stolen_booty);
+static void FDECL(get_level_extends, (int *, int *, int *, int *));
 
 /* adjust a coordinate one step in the specified direction */
 #define mz_move(X, Y, dir) \
@@ -1224,18 +1225,9 @@ coord *cc;
     return;
 }
 
-/* put a non-diggable boundary around the initial portion of a level map.
- * assumes that no level will initially put things beyond the isok() range.
- *
- * we can't bound unconditionally on the last line with something in it,
- * because that something might be a niche which was already reachable,
- * so the boundary would be breached
- *
- * we can't bound unconditionally on one beyond the last line, because
- * that provides a window of abuse for wallified special levels
- */
-void
-bound_digging()
+static void
+get_level_extends(left, top, right, bottom)
+int *left, *top, *right, *bottom;
 {
     int x, y;
     unsigned typ;
@@ -1243,9 +1235,6 @@ bound_digging()
     boolean found, nonwall;
     int xmin, xmax, ymin, ymax;
 
-    if (Is_earthlevel(&u.uz))
-        return; /* everything diggable here */
-
     found = nonwall = FALSE;
     for (xmin = 0; !found && xmin <= COLNO; xmin++) {
         lev = &levl[xmin][0];
@@ -1306,16 +1295,37 @@ bound_digging()
     }
     ymax += (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
 
+    *left = xmin;
+    *right = xmax;
+    *top = ymin;
+    *bottom = ymax;
+}
+
+/* put a non-diggable boundary around the initial portion of a level map.
+ * assumes that no level will initially put things beyond the isok() range.
+ *
+ * we can't bound unconditionally on the last line with something in it,
+ * because that something might be a niche which was already reachable,
+ * so the boundary would be breached
+ *
+ * we can't bound unconditionally on one beyond the last line, because
+ * that provides a window of abuse for wallified special levels
+ */
+void
+bound_digging()
+{
+    int x, y;
+    int xmin, xmax, ymin, ymax;
+
+    if (Is_earthlevel(&u.uz))
+        return; /* everything diggable here */
+
+    get_level_extends(&xmin, &ymin, &xmax, &ymax);
+
     for (x = 0; x < COLNO; x++)
         for (y = 0; y < ROWNO; y++)
-            if (y <= ymin || y >= ymax || x <= xmin || x >= xmax) {
-#ifdef DCC30_BUG
-                lev = &levl[x][y];
-                lev->wall_info |= W_NONDIGGABLE;
-#else
+            if (y <= ymin || y >= ymax || x <= xmin || x >= xmax)
                 levl[x][y].wall_info |= W_NONDIGGABLE;
-#endif
-            }
 }
 
 void