From 1442993f308db1aab55dda4ce8a87d65e77cfe6f Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 16 Oct 2019 20:07:56 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20store=5Fheight()=20?= =?utf8?q?=E3=81=AB=20floor=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0=EF=BC=8E=20/=20Add=20floor=5Ftype=20*=20argum?= =?utf8?q?ent=20to=20store=5Fheight().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/rooms.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/rooms.c b/src/rooms.c index dcffa502f..4b36ab752 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -526,9 +526,9 @@ struct fill_data_type static fill_data_type fill_data; -/* Store routine for the fractal p_ptr->current_floor_ptr->grid_array generator */ +/* Store routine for the fractal floor generator */ /* this routine probably should be an inline function or a macro. */ -static void store_height(POSITION x, POSITION y, FEAT_IDX val) +static void store_height(floor_type *floor_ptr, POSITION x, POSITION y, FEAT_IDX val) { /* if on boundary set val > cutoff so walls are not as square */ if (((x == fill_data.xmin) || (y == fill_data.ymin) || @@ -536,7 +536,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) (val <= fill_data.c1)) val = fill_data.c1 + 1; /* store the value in height-map format */ - p_ptr->current_floor_ptr->grid_array[y][x].feat = val; + floor_ptr->grid_array[y][x].feat = val; return; } @@ -709,12 +709,12 @@ void generate_hmap(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsi if (xhstep2 > grd) { /* If greater than 'grid' level then is random */ - store_height(ii, jj, randint1(maxsize)); + store_height(floor_ptr, ii, jj, randint1(maxsize)); } else { /* Average of left and right points +random bit */ - store_height(ii, jj, + store_height(floor_ptr, ii, jj, (floor_ptr->grid_array[jj][fill_data.xmin + (i - xhstep) / 256].feat + floor_ptr->grid_array[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2 + (randint1(xstep2) - xhstep2) * roug / 16); @@ -739,12 +739,12 @@ void generate_hmap(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsi if (xhstep2 > grd) { /* If greater than 'grid' level then is random */ - store_height(ii, jj, randint1(maxsize)); + store_height(floor_ptr, ii, jj, randint1(maxsize)); } else { /* Average of up and down points +random bit */ - store_height(ii, jj, + store_height(floor_ptr, ii, jj, (floor_ptr->grid_array[fill_data.ymin + (j - yhstep) / 256][ii].feat + floor_ptr->grid_array[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2 + (randint1(ystep2) - yhstep2) * roug / 16); @@ -768,7 +768,7 @@ void generate_hmap(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsi if (xhstep2 > grd) { /* If greater than 'grid' level then is random */ - store_height(ii, jj, randint1(maxsize)); + store_height(floor_ptr, ii, jj, randint1(maxsize)); } else { @@ -782,7 +782,7 @@ void generate_hmap(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsi * Average over all four corners + scale by diagsize to * reduce the effect of the square grid on the shape of the fractal */ - store_height(ii, jj, + store_height(floor_ptr, ii, jj, (floor_ptr->grid_array[ym][xm].feat + floor_ptr->grid_array[yp][xm].feat + floor_ptr->grid_array[ym][xp].feat + floor_ptr->grid_array[yp][xp].feat) / 4 + (randint1(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug); -- 2.11.0