/*
* Aux function -- see below
*/
-static void cave_temp_room_aux(int y, int x)
+static void cave_temp_room_aux(int y, int x, bool only_room)
{
cave_type *c_ptr;
/* Do not "leave" the current room */
if (!(c_ptr->info & (CAVE_ROOM)))
{
+ if (only_room) return;
+
/* Verify */
if (!in_bounds(y, x)) return;
temp_n++;
}
+/*
+ * Aux function -- see below
+ */
+static void cave_temp_lite_room_aux(int y, int x)
+{
+ cave_temp_room_aux(y, x, FALSE);
+}
+
+/*
+ * Aux function -- see below
+ */
+static void cave_temp_unlite_room_aux(int y, int x)
+{
+ cave_temp_room_aux(y, x, TRUE);
+}
+
int i, x, y;
/* Add the initial grid */
- cave_temp_room_aux(y1, x1);
+ cave_temp_lite_room_aux(y1, x1);
/* While grids are in the queue, add their neighbors */
for (i = 0; i < temp_n; i++)
if (!cave_floor_bold(y, x)) continue;
/* Spread adjacent */
- cave_temp_room_aux(y + 1, x);
- cave_temp_room_aux(y - 1, x);
- cave_temp_room_aux(y, x + 1);
- cave_temp_room_aux(y, x - 1);
+ cave_temp_lite_room_aux(y + 1, x);
+ cave_temp_lite_room_aux(y - 1, x);
+ cave_temp_lite_room_aux(y, x + 1);
+ cave_temp_lite_room_aux(y, x - 1);
/* Spread diagonal */
- cave_temp_room_aux(y + 1, x + 1);
- cave_temp_room_aux(y - 1, x - 1);
- cave_temp_room_aux(y - 1, x + 1);
- cave_temp_room_aux(y + 1, x - 1);
+ cave_temp_lite_room_aux(y + 1, x + 1);
+ cave_temp_lite_room_aux(y - 1, x - 1);
+ cave_temp_lite_room_aux(y - 1, x + 1);
+ cave_temp_lite_room_aux(y + 1, x - 1);
}
/* Now, lite them all up at once */
int i, x, y;
/* Add the initial grid */
- cave_temp_room_aux(y1, x1);
+ cave_temp_unlite_room_aux(y1, x1);
/* Spread, breadth first */
for (i = 0; i < temp_n; i++)
if (!cave_floor_bold(y, x)) continue;
/* Spread adjacent */
- cave_temp_room_aux(y + 1, x);
- cave_temp_room_aux(y - 1, x);
- cave_temp_room_aux(y, x + 1);
- cave_temp_room_aux(y, x - 1);
+ cave_temp_unlite_room_aux(y + 1, x);
+ cave_temp_unlite_room_aux(y - 1, x);
+ cave_temp_unlite_room_aux(y, x + 1);
+ cave_temp_unlite_room_aux(y, x - 1);
/* Spread diagonal */
- cave_temp_room_aux(y + 1, x + 1);
- cave_temp_room_aux(y - 1, x - 1);
- cave_temp_room_aux(y - 1, x + 1);
- cave_temp_room_aux(y + 1, x - 1);
+ cave_temp_unlite_room_aux(y + 1, x + 1);
+ cave_temp_unlite_room_aux(y - 1, x - 1);
+ cave_temp_unlite_room_aux(y - 1, x + 1);
+ cave_temp_unlite_room_aux(y + 1, x - 1);
}
/* Now, darken them all at once */