/* Hack XXX XXX - Is it a wall and monster not in LOS? */
if (!cave_floor_grid(c_ptr) && mon_invis) return;
- if (temp_n < TEMP_MAX)
- {
- /* New grid */
- if (!(c_ptr->info & CAVE_MNDK))
- {
- /* Save this square */
- temp_x[temp_n] = x;
- temp_y[temp_n] = y;
- temp_n++;
- }
+ /* We trust temp_n does not exceed TEMP_MAX */
- /* Darkened grid */
- else
- {
- /* No longer dark */
- c_ptr->info &= ~(CAVE_MNDK);
- }
+ /* New grid */
+ if (!(c_ptr->info & CAVE_MNDK))
+ {
+ /* Save this square */
+ temp_x[temp_n] = x;
+ temp_y[temp_n] = y;
+ temp_n++;
+ }
- /* Light it */
- c_ptr->info |= CAVE_MNLT;
+ /* Darkened grid */
+ else
+ {
+ /* No longer dark */
+ c_ptr->info &= ~(CAVE_MNDK);
}
+
+ /* Light it */
+ c_ptr->info |= CAVE_MNLT;
}
/* Hack XXX XXX - Is it a wall and monster not in LOS? */
if (!cave_floor_grid(c_ptr) && mon_invis) return;
- if (temp_n < TEMP_MAX)
- {
- /* Save this square */
- temp_x[temp_n] = x;
- temp_y[temp_n] = y;
- temp_n++;
+ /* We trust temp_n does not exceed TEMP_MAX */
- /* Darken it */
- c_ptr->info |= CAVE_MNDK;
- }
+ /* Save this square */
+ temp_x[temp_n] = x;
+ temp_y[temp_n] = y;
+ temp_n++;
+
+ /* Darken it */
+ c_ptr->info |= CAVE_MNDK;
}
#define LITE_MAX 600
/*
+ * Maximum size of the "mon_lite" array (see "cave.c")
+ * Note that the "view radius" will NEVER exceed 20, monster illumination
+ * flags are dependent on CAVE_VIEW, and even if the "view" was octagonal,
+ * we would never require more than 1520 entries in the array.
+ */
+#define MON_LITE_MAX 1536
+
+/*
* Maximum size of the "view" array (see "cave.c")
* Note that the "view radius" will NEVER exceed 20, and even if the "view"
* was octagonal, we would never require more than 1520 entries in the array.
* must also be large enough to allow "good enough" use as a circular queue,
* to calculate monster flow, but note that the flow code is "paranoid".
*/
-#define TEMP_MAX 1536
+#define TEMP_MAX 2298
+
+/*
+ * Maximum size of the "redraw" array (see "cave.c")
+ * We must be large for proper functioning of delayed redrawing.
+ * We must also be as large as two times of the largest view area.
+ * Note that maximum view grids are 1149 entries.
+ */
+#define REDRAW_MAX 2298
/*
extern s16b lite_y[LITE_MAX];
extern s16b lite_x[LITE_MAX];
extern s16b mon_lite_n;
-extern s16b mon_lite_y[LITE_MAX];
-extern s16b mon_lite_x[LITE_MAX];
+extern s16b mon_lite_y[MON_LITE_MAX];
+extern s16b mon_lite_x[MON_LITE_MAX];
extern s16b view_n;
extern byte view_y[VIEW_MAX];
extern byte view_x[VIEW_MAX];
extern byte temp_y[TEMP_MAX];
extern byte temp_x[TEMP_MAX];
extern s16b redraw_n;
-extern byte redraw_y[TEMP_MAX];
-extern byte redraw_x[TEMP_MAX];
+extern byte redraw_y[REDRAW_MAX];
+extern byte redraw_x[REDRAW_MAX];
extern s16b macro__num;
extern cptr *macro__pat;
extern cptr *macro__act;
* Array of grids lit by player lite (see "cave.c")
*/
s16b mon_lite_n;
-s16b mon_lite_y[LITE_MAX];
-s16b mon_lite_x[LITE_MAX];
+s16b mon_lite_y[MON_LITE_MAX];
+s16b mon_lite_x[MON_LITE_MAX];
/*
* Array of grids viewable to the player (see "cave.c")
/*
* Array of grids for delayed visual updating (see "cave.c")
*/
-s16b redraw_n;
-byte redraw_y[TEMP_MAX];
-byte redraw_x[TEMP_MAX];
+s16b redraw_n = 0;
+byte redraw_y[REDRAW_MAX];
+byte redraw_x[REDRAW_MAX];
/*