From 55b16a7c636ad4f5f2d163a47bcd42844a592706 Mon Sep 17 00:00:00 2001 From: nothere Date: Sun, 29 Jun 2003 08:42:25 +0000 Subject: [PATCH] =?utf8?q?=E5=A3=81=E3=81=8C=E5=85=A8=E3=81=8F=E3=81=AA?= =?utf8?q?=E3=81=8F=E7=9C=9F=E3=81=AE=E6=9C=80=E5=A4=A7=E8=A6=96=E7=95=8C?= =?utf8?q?=E7=AF=84=E5=9B=B2(=E5=8D=8A=E5=BE=8420,=20=E7=B7=8F=E3=82=B0?= =?utf8?q?=E3=83=AA=E3=83=83=E3=83=89=E6=95=B01149)=E3=82=92=E5=8F=96?= =?utf8?q?=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=AB,=20=E8=A6=96=E7=95=8C?= =?utf8?q?=E7=AF=84=E5=9B=B2=E3=82=84=E3=83=A2=E3=83=B3=E3=82=B9=E3=82=BF?= =?utf8?q?=E3=83=BC=E5=85=89=E6=BA=90=E7=AF=84=E5=9B=B2=E3=81=AE=E5=86=8D?= =?utf8?q?=E8=A8=88=E7=AE=97=E3=81=A7temp=5F*[]=E3=82=84redraw=5F*[]?= =?utf8?q?=E3=81=8C=E3=82=AA=E3=83=BC=E3=83=90=E3=83=BC=20=E3=83=95?= =?utf8?q?=E3=83=AD=E3=83=BC=E3=81=97=E3=81=A6=E5=A4=89=E6=84=9A=E8=9B=AE?= =?utf8?q?=E6=80=92=E3=81=8C=E8=90=BD=E3=81=A1=E3=81=A6=E3=81=84=E3=81=9F?= =?utf8?q?=E3=81=AE=E3=81=A7,=20=E9=96=A2=E9=80=A3=E3=81=99=E3=82=8B?= =?utf8?q?=E3=83=90=E3=83=83=E3=83=95=E3=82=A1=E3=82=92=E3=81=95=E3=82=89?= =?utf8?q?=E3=81=AB=E6=8B=A1=E5=BC=B5.=20=E3=81=BE=20=E3=81=9F,=20mon=5Fli?= =?utf8?q?te=5Fhack()=E3=82=84mon=5Fdark=5Fhack()=E3=81=A7=E3=81=AF?= =?utf8?q?=E3=83=90=E3=83=83=E3=83=95=E3=82=A1=E3=81=8C=E3=81=82=E3=81=B5?= =?utf8?q?=E3=82=8C=E3=81=AA=E3=81=84=E3=81=A8=E4=BB=AE=E5=AE=9A=E3=81=99?= =?utf8?q?=20=E3=82=8B=E3=81=93=E3=81=A8=E3=81=A7,=20=E6=AF=94=E8=BC=83?= =?utf8?q?=E3=82=92=E6=B8=9B=E3=82=89=E3=81=97=E3=81=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cave.c | 52 +++++++++++++++++++++++++--------------------------- src/defines.h | 18 +++++++++++++++++- src/externs.h | 8 ++++---- src/variable.c | 10 +++++----- 4 files changed, 51 insertions(+), 37 deletions(-) diff --git a/src/cave.c b/src/cave.c index 8878fbfeb..2617819e6 100644 --- a/src/cave.c +++ b/src/cave.c @@ -3205,27 +3205,26 @@ static void mon_lite_hack(int y, int x) /* 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; } @@ -3247,16 +3246,15 @@ static void mon_dark_hack(int y, int x) /* 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; } diff --git a/src/defines.h b/src/defines.h index 10db0ca4e..c8eabea41 100644 --- a/src/defines.h +++ b/src/defines.h @@ -389,6 +389,14 @@ #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. @@ -403,7 +411,15 @@ * 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 /* diff --git a/src/externs.h b/src/externs.h index e2907832b..21999806d 100644 --- a/src/externs.h +++ b/src/externs.h @@ -349,8 +349,8 @@ extern s16b lite_n; 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]; @@ -358,8 +358,8 @@ extern s16b temp_n; 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; diff --git a/src/variable.c b/src/variable.c index b1019ec5b..3c7a861e6 100644 --- a/src/variable.c +++ b/src/variable.c @@ -385,8 +385,8 @@ s16b lite_x[LITE_MAX]; * 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") @@ -405,9 +405,9 @@ byte temp_x[TEMP_MAX]; /* * 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]; /* -- 2.11.0