From 6ab7f21598ff3dd42d580033c2474599083d995a Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 7 Dec 2019 18:44:50 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20place=5Fextra=5Fbold()=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=20place=5Fextra=5Fbold().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor-generate.c | 10 +++++----- src/grid.h | 8 ++++---- src/rooms-normal.c | 6 +++--- src/rooms-vault.c | 6 +++--- src/rooms.c | 24 ++++++++++++------------ 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/floor-generate.c b/src/floor-generate.c index 22fd8c550..851650233 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -643,15 +643,15 @@ static bool cave_gen(floor_type *floor_ptr) /* Special boundary walls -- Top and bottom */ for (x = 0; x < floor_ptr->width; x++) { - place_extra_bold(0, x); - place_extra_bold(floor_ptr->height - 1, x); + place_extra_bold(floor_ptr, 0, x); + place_extra_bold(floor_ptr, floor_ptr->height - 1, x); } /* Special boundary walls -- Left and right */ for (y = 1; y < (floor_ptr->height - 1); y++) { - place_extra_bold(y, 0); - place_extra_bold(y, floor_ptr->width - 1); + place_extra_bold(floor_ptr, y, 0); + place_extra_bold(floor_ptr, y, floor_ptr->width - 1); } } else @@ -661,7 +661,7 @@ static bool cave_gen(floor_type *floor_ptr) { for (x = 0; x < floor_ptr->width; x++) { - place_extra_bold(y, x); + place_extra_bold(floor_ptr, y, x); } } } diff --git a/src/grid.h b/src/grid.h index c70c9d58e..28697ea6d 100644 --- a/src/grid.h +++ b/src/grid.h @@ -136,11 +136,11 @@ typedef struct if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ } -#define place_extra_bold(Y, X) \ +#define place_extra_bold(F, Y, X) \ { \ - set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_type[randint0(100)]); \ - p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ - add_cave_info(p_ptr->current_floor_ptr, Y,X,CAVE_EXTRA); \ + set_cave_feat((F), Y,X,feat_wall_type[randint0(100)]); \ + (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \ + add_cave_info((F), Y,X,CAVE_EXTRA); \ delete_monster(Y, X); \ } diff --git a/src/rooms-normal.c b/src/rooms-normal.c index 52bf00929..4a0fda526 100644 --- a/src/rooms-normal.c +++ b/src/rooms-normal.c @@ -938,7 +938,7 @@ bool build_type11(floor_type *floor_ptr) else if (distance(y0, x0, y, x) <= rad + 1) { /* make granite outside so arena works */ - place_extra_bold(y, x); + place_extra_bold(floor_ptr, y, x); } } } @@ -1000,14 +1000,14 @@ bool build_type12(floor_type *floor_ptr) else { /* make granite outside so arena works */ - place_extra_bold(y, x); + place_extra_bold(floor_ptr, y, x); } /* proper boundary for arena */ if (((y + rad) == y0) || ((y - rad) == y0) || ((x + rad) == x0) || ((x - rad) == x0)) { - place_extra_bold(y, x); + place_extra_bold(floor_ptr, y, x); } } } diff --git a/src/rooms-vault.c b/src/rooms-vault.c index 8983fe16f..8a3adcdb2 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -189,7 +189,7 @@ static void build_room_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, PO { POSITION y = y0 - yhsize + y1; - place_extra_bold(y, x); + place_extra_bold(floor_ptr, y, x); floor_ptr->grid_array[y][x].info &= (~CAVE_ICKY); } } @@ -848,14 +848,14 @@ static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, else { /* make granite outside so arena works */ - place_extra_bold(y, x); + place_extra_bold(floor_ptr, y, x); } /* proper boundary for arena */ if (((y + rad) == y0) || ((y - rad) == y0) || ((x + rad) == x0) || ((x - rad) == x0)) { - place_extra_bold(y, x); + place_extra_bold(floor_ptr, y, x); } } } diff --git a/src/rooms.c b/src/rooms.c index b3e3fb16e..cd02e19aa 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -995,7 +995,7 @@ bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION { for (y = 0; y <= ysize; ++y) { - place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); + place_extra_bold(floor_ptr, y0 + y - yhsize, x0 + x - xhsize); floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); } } @@ -1021,7 +1021,7 @@ bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION else { /* set to be normal granite */ - place_extra_bold(y0 + 0 - yhsize, x0 + i - xhsize); + place_extra_bold(floor_ptr, y0 + 0 - yhsize, x0 + i - xhsize); } /* bottom boundary */ @@ -1036,7 +1036,7 @@ bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION else { /* set to be normal granite */ - place_extra_bold(y0 + ysize - yhsize, x0 + i - xhsize); + place_extra_bold(floor_ptr, y0 + ysize - yhsize, x0 + i - xhsize); } /* clear the icky flag-don't need it any more */ @@ -1059,7 +1059,7 @@ bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION else { /* outside room */ - place_extra_bold(y0 + i - yhsize, x0 + 0 - xhsize); + place_extra_bold(floor_ptr, y0 + i - yhsize, x0 + 0 - xhsize); } /* right boundary */ if ((floor_ptr->grid_array[i + y0 - yhsize][xsize + x0 - xhsize].info & CAVE_ICKY) && room) @@ -1073,7 +1073,7 @@ bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION else { /* outside room */ - place_extra_bold(y0 + i - yhsize, x0 + xsize - xhsize); + place_extra_bold(floor_ptr, y0 + i - yhsize, x0 + xsize - xhsize); } /* clear icky flag -done with it */ @@ -1110,14 +1110,14 @@ bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION else { - place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); + place_extra_bold(floor_ptr, y0 + y - yhsize, x0 + x - xhsize); floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ROOM); } } else { /* Clear the unconnected regions */ - place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); + place_extra_bold(floor_ptr, y0 + y - yhsize, x0 + x - xhsize); floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); } } @@ -1276,8 +1276,8 @@ bool generate_lake(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsi /* Do boundarys- set to normal granite */ for (i = 0; i <= xsize; ++i) { - place_extra_bold(y0 + 0 - yhsize, x0 + i - xhsize); - place_extra_bold(y0 + ysize - yhsize, x0 + i - xhsize); + place_extra_bold(floor_ptr, y0 + 0 - yhsize, x0 + i - xhsize); + place_extra_bold(floor_ptr, y0 + ysize - yhsize, x0 + i - xhsize); /* clear the icky flag-don't need it any more */ floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); @@ -1288,8 +1288,8 @@ bool generate_lake(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsi for (i = 1; i < ysize; ++i) { - place_extra_bold(y0 + i - yhsize, x0 + 0 - xhsize); - place_extra_bold(y0 + i - yhsize, x0 + xsize - xhsize); + place_extra_bold(floor_ptr, y0 + i - yhsize, x0 + 0 - xhsize); + place_extra_bold(floor_ptr, y0 + i - yhsize, x0 + xsize - xhsize); /* clear icky flag -done with it */ floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); @@ -1305,7 +1305,7 @@ bool generate_lake(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsi /* Fill unconnected regions with granite */ if ((!(floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) || is_outer_bold(floor_ptr, y0 + y - yhsize, x0 + x - xhsize)) - place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); + place_extra_bold(floor_ptr, y0 + y - yhsize, x0 + x - xhsize); /* turn off icky flag (no longer needed.) */ floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); -- 2.11.0