From 0702364477da16556f13ea8f4b839d1ae5eff4a5 Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 21 Aug 2019 23:33:26 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20rooms-pitnest.c=E3=80=80?= =?utf8?q?=E5=86=85=E9=96=A2=E6=95=B0=E3=81=AB=20floor=5Ftype=20*=20?= =?utf8?q?=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0=EF=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/rooms-pitnest.c | 76 ++++++++++++++++++++++++++--------------------------- src/rooms-pitnest.h | 6 ++--- src/rooms.c | 6 ++--- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/rooms-pitnest.c b/src/rooms-pitnest.c index 1e922f5a4..00bb1772d 100644 --- a/src/rooms-pitnest.c +++ b/src/rooms-pitnest.c @@ -283,7 +283,7 @@ static vault_aux_type pit_types[] = *\n * Note that "monster nests" will never contain "unique" monsters.\n */ -bool build_type5(void) +bool build_type5(floor_type *floor_ptr) { POSITION y, x, y1, x1, y2, x2, xval, yval; int i; @@ -317,7 +317,7 @@ bool build_type5(void) while (attempts--) { /* Get a (hard) monster type */ - r_idx = get_mon_num(current_floor_ptr->dun_level + 11); + r_idx = get_mon_num(floor_ptr->dun_level + 11); r_ptr = &r_info[r_idx]; /* Decline incorrect alignment */ @@ -352,7 +352,7 @@ bool build_type5(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &floor_ptr->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); } @@ -361,16 +361,16 @@ bool build_type5(void) /* Place the outer walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x1 - 1]; + g_ptr = &floor_ptr->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y][x2 + 1]; + g_ptr = &floor_ptr->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y1 - 1][x]; + g_ptr = &floor_ptr->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y2 + 1][x]; + g_ptr = &floor_ptr->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -384,17 +384,17 @@ bool build_type5(void) /* The inner walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x1 - 1]; + g_ptr = &floor_ptr->grid_array[y][x1 - 1]; place_inner_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y][x2 + 1]; + g_ptr = &floor_ptr->grid_array[y][x2 + 1]; place_inner_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y1 - 1][x]; + g_ptr = &floor_ptr->grid_array[y1 - 1][x]; place_inner_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y2 + 1][x]; + g_ptr = &floor_ptr->grid_array[y2 + 1][x]; place_inner_grid(g_ptr); } for (y = y1; y <= y2; y++) @@ -491,7 +491,7 @@ bool build_type5(void) *\n * Note that "monster pits" will never contain "unique" monsters.\n */ -bool build_type6(void) +bool build_type6(floor_type *floor_ptr) { POSITION y, x, y1, x1, y2, x2, xval, yval; int i, j; @@ -526,7 +526,7 @@ bool build_type6(void) while (attempts--) { /* Get a (hard) monster type */ - r_idx = get_mon_num(current_floor_ptr->dun_level + 11); + r_idx = get_mon_num(floor_ptr->dun_level + 11); r_ptr = &r_info[r_idx]; /* Decline incorrect alignment */ @@ -560,7 +560,7 @@ bool build_type6(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &floor_ptr->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); } @@ -569,16 +569,16 @@ bool build_type6(void) /* Place the outer walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x1 - 1]; + g_ptr = &floor_ptr->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y][x2 + 1]; + g_ptr = &floor_ptr->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y1 - 1][x]; + g_ptr = &floor_ptr->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y2 + 1][x]; + g_ptr = &floor_ptr->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -591,16 +591,16 @@ bool build_type6(void) /* The inner walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x1 - 1]; + g_ptr = &floor_ptr->grid_array[y][x1 - 1]; place_inner_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y][x2 + 1]; + g_ptr = &floor_ptr->grid_array[y][x2 + 1]; place_inner_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y1 - 1][x]; + g_ptr = &floor_ptr->grid_array[y1 - 1][x]; place_inner_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y2 + 1][x]; + g_ptr = &floor_ptr->grid_array[y2 + 1][x]; place_inner_grid(g_ptr); } for (y = y1; y <= y2; y++) @@ -767,7 +767,7 @@ static bool vault_aux_trapped_pit(MONRACE_IDX r_idx) *\n * Note that "monster pits" will never contain "unique" monsters.\n */ -bool build_type13(void) +bool build_type13(floor_type *floor_ptr) { static int placing[][3] = { { -2, -9, 0 },{ -2, -8, 0 },{ -3, -7, 0 },{ -3, -6, 0 }, @@ -834,7 +834,7 @@ bool build_type13(void) while (attempts--) { /* Get a (hard) monster type */ - r_idx = get_mon_num(current_floor_ptr->dun_level + 0); + r_idx = get_mon_num(floor_ptr->dun_level + 0); r_ptr = &r_info[r_idx]; /* Decline incorrect alignment */ @@ -868,7 +868,7 @@ bool build_type13(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &floor_ptr->grid_array[y][x]; place_inner_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); } @@ -877,11 +877,11 @@ bool build_type13(void) /* Place the floor area 1 */ for (x = x1 + 3; x <= x2 - 3; x++) { - g_ptr = ¤t_floor_ptr->grid_array[yval - 2][x]; + g_ptr = &floor_ptr->grid_array[yval - 2][x]; place_floor_grid(g_ptr); add_cave_info(yval - 2, x, CAVE_ICKY); - g_ptr = ¤t_floor_ptr->grid_array[yval + 2][x]; + g_ptr = &floor_ptr->grid_array[yval + 2][x]; place_floor_grid(g_ptr); add_cave_info(yval + 2, x, CAVE_ICKY); } @@ -889,11 +889,11 @@ bool build_type13(void) /* Place the floor area 2 */ for (x = x1 + 5; x <= x2 - 5; x++) { - g_ptr = ¤t_floor_ptr->grid_array[yval - 3][x]; + g_ptr = &floor_ptr->grid_array[yval - 3][x]; place_floor_grid(g_ptr); add_cave_info(yval - 3, x, CAVE_ICKY); - g_ptr = ¤t_floor_ptr->grid_array[yval + 3][x]; + g_ptr = &floor_ptr->grid_array[yval + 3][x]; place_floor_grid(g_ptr); add_cave_info(yval + 3, x, CAVE_ICKY); } @@ -901,27 +901,27 @@ bool build_type13(void) /* Corridor */ for (x = x1; x <= x2; x++) { - g_ptr = ¤t_floor_ptr->grid_array[yval][x]; + g_ptr = &floor_ptr->grid_array[yval][x]; place_floor_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y1][x]; + g_ptr = &floor_ptr->grid_array[y1][x]; place_floor_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y2][x]; + g_ptr = &floor_ptr->grid_array[y2][x]; place_floor_grid(g_ptr); } /* Place the outer walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x1 - 1]; + g_ptr = &floor_ptr->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y][x2 + 1]; + g_ptr = &floor_ptr->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y1 - 1][x]; + g_ptr = &floor_ptr->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y2 + 1][x]; + g_ptr = &floor_ptr->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -954,8 +954,8 @@ bool build_type13(void) } /* Place the wall open trap */ - current_floor_ptr->grid_array[yval][xval].mimic = current_floor_ptr->grid_array[yval][xval].feat; - current_floor_ptr->grid_array[yval][xval].feat = feat_trap_open; + floor_ptr->grid_array[yval][xval].mimic = floor_ptr->grid_array[yval][xval].feat; + floor_ptr->grid_array[yval][xval].feat = feat_trap_open; /* Sort the entries */ for (i = 0; i < 16 - 1; i++) diff --git a/src/rooms-pitnest.h b/src/rooms-pitnest.h index 21b6640ce..140e4f406 100644 --- a/src/rooms-pitnest.h +++ b/src/rooms-pitnest.h @@ -7,6 +7,6 @@ typedef struct } nest_mon_info_type; -extern bool build_type5(void); -extern bool build_type6(void); -extern bool build_type13(void); +extern bool build_type5(floor_type *floor_ptr); +extern bool build_type6(floor_type *floor_ptr); +extern bool build_type13(floor_type *floor_ptr); diff --git a/src/rooms.c b/src/rooms.c index de9fd00e9..81f007d4d 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -2090,15 +2090,15 @@ static bool room_build(EFFECT_ID typ) case ROOM_T_OVERLAP: return build_type2(current_floor_ptr); case ROOM_T_CROSS: return build_type3(current_floor_ptr); case ROOM_T_INNER_FEAT: return build_type4(current_floor_ptr); - case ROOM_T_NEST: return build_type5(); - case ROOM_T_PIT: return build_type6(); + case ROOM_T_NEST: return build_type5(current_floor_ptr); + case ROOM_T_PIT: return build_type6(current_floor_ptr); case ROOM_T_LESSER_VAULT: return build_type7(); case ROOM_T_GREATER_VAULT: return build_type8(); case ROOM_T_FRACAVE: return build_type9(); case ROOM_T_RANDOM_VAULT: return build_type10(); case ROOM_T_OVAL: return build_type11(current_floor_ptr); case ROOM_T_CRYPT: return build_type12(current_floor_ptr); - case ROOM_T_TRAP_PIT: return build_type13(); + case ROOM_T_TRAP_PIT: return build_type13(current_floor_ptr); case ROOM_T_TRAP: return build_type14(); case ROOM_T_GLASS: return build_type15(); case ROOM_T_ARCADE: return build_type16(); -- 2.11.0