From bf8e10f6fbd3439a917f02aa803c7a9c0b9175e6 Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 21 Sep 2019 12:21:46 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20is=5Ffloor=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=20is=5Ffloor=5Fbold().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor-generate.c | 2 +- src/grid.c | 6 +++--- src/grid.h | 5 ++--- src/rooms-normal.c | 2 +- src/rooms-vault.c | 2 +- src/rooms.c | 6 +++--- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/floor-generate.c b/src/floor-generate.c index ee37df309..c27fbc9cd 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -1770,7 +1770,7 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) else return FALSE; } - if (is_floor_bold(*y, *x)) + if (is_floor_bold(p_ptr->current_floor_ptr, *y, *x)) { /* Don't do anything */ return TRUE; diff --git a/src/grid.c b/src/grid.c index 2a4fd36d8..3159996d3 100644 --- a/src/grid.c +++ b/src/grid.c @@ -502,7 +502,7 @@ void add_door(POSITION x, POSITION y) * .=floor, #=wall */ - if (is_floor_bold(y - 1, x) && is_floor_bold(y + 1, x) && + if (is_floor_bold(p_ptr->current_floor_ptr, y - 1, x) && is_floor_bold(p_ptr->current_floor_ptr, y + 1, x) && (is_outer_bold(y, x - 1) && is_outer_bold(y, x + 1))) { /* secret door */ @@ -523,7 +523,7 @@ void add_door(POSITION x, POSITION y) * .=floor, #=wall */ if (is_outer_bold(y - 1, x) && is_outer_bold(y + 1, x) && - is_floor_bold(y, x - 1) && is_floor_bold(y, x + 1)) + is_floor_bold(p_ptr->current_floor_ptr, y, x - 1) && is_floor_bold(p_ptr->current_floor_ptr, y, x + 1)) { /* secret door */ place_secret_door(y, x, DOOR_DEFAULT); @@ -867,7 +867,7 @@ bool get_is_floor(POSITION x, POSITION y) } /* Do the real check */ - if (is_floor_bold(y, x)) return (TRUE); + if (is_floor_bold(p_ptr->current_floor_ptr, y, x)) return (TRUE); return (FALSE); } diff --git a/src/grid.h b/src/grid.h index 5fa1bd6d4..bfecd6ad8 100644 --- a/src/grid.h +++ b/src/grid.h @@ -41,8 +41,7 @@ * Note the special fields for the "MONSTER_FLOW" code. */ -typedef struct player_type player_type; - +typedef struct player_type player_type; // TODO: Delete Finally. typedef struct grid_type grid_type; @@ -100,7 +99,7 @@ typedef struct * @param X 指定X座標 * @return FLOOR属性を持っているならばTRUE */ -#define is_floor_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_FLOOR) +#define is_floor_bold(F,Y,X) (F->grid_array[Y][X].info & CAVE_FLOOR) #define is_extra_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_EXTRA) #define is_inner_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_INNER) diff --git a/src/rooms-normal.c b/src/rooms-normal.c index d749f9c32..9d74463cd 100644 --- a/src/rooms-normal.c +++ b/src/rooms-normal.c @@ -1021,7 +1021,7 @@ bool build_type12(floor_type *floor_ptr) { for (y = y0 - 2; y <= y0 + 2; y++) { - if (!is_floor_bold(y, x)) + if (!is_floor_bold(floor_ptr, y, x)) { /* Wall in the way */ emptyflag = FALSE; diff --git a/src/rooms-vault.c b/src/rooms-vault.c index ff0cc732d..d71ae91d5 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -1111,7 +1111,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { total = x - x1 + y - y1; /* If total is odd- and is a floor then make a wall */ - if ((total % 2 == 1) && is_floor_bold(y, x)) + if ((total % 2 == 1) && is_floor_bold(p_ptr->current_floor_ptr, y, x)) { place_inner_bold(y, x); } diff --git a/src/rooms.c b/src/rooms.c index df56108c4..d2accd15c 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -1086,7 +1086,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, { for (y = 1; y < ysize; ++y) { - if (is_floor_bold(y0 + y - yhsize, x0 + x - xhsize) && + if (is_floor_bold(p_ptr->current_floor_ptr, y0 + y - yhsize, x0 + x - xhsize) && (p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) { /* Clear the icky flag in the filled region */ @@ -1403,7 +1403,7 @@ void fill_treasure(floor_type *floor_ptr, POSITION x1, POSITION x2, POSITION y1, if ((randint1(100) - difficulty * 3) > 50) value = 20; /* if floor, shallow water and lava */ - if (is_floor_bold(y, x) || + if (is_floor_bold(p_ptr->current_floor_ptr, y, x) || (cave_have_flag_bold(y, x, FF_PLACE) && cave_have_flag_bold(y, x, FF_DROP))) { /* The smaller 'value' is, the better the stuff */ @@ -1982,7 +1982,7 @@ void add_outer_wall(POSITION x, POSITION y, int light, POSITION x1, POSITION y1, f_ptr = &f_info[g_ptr->feat]; - if (is_floor_bold(y, x)) + if (is_floor_bold(p_ptr->current_floor_ptr, y, x)) { for (i = -1; i <= 1; i++) { -- 2.11.0