From 76ed9db632d2d02fc5ce66fcf8a6e18d034b04e9 Mon Sep 17 00:00:00 2001 From: deskull Date: Fri, 6 Dec 2019 19:26:54 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20build=5Fstreamer()=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=20build=5Fstreamer().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd/cmd-basic.c | 1 - src/floor-generate.c | 4 ++-- src/floor-streams.c | 18 +++++++++--------- src/floor-streams.h | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index baa2e7830..6ad13a2ad 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -2865,7 +2865,6 @@ void do_cmd_suicide(player_type *creature_ptr) if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return; } - if (!creature_ptr->noscore) { /* Special Verification for suicide */ diff --git a/src/floor-generate.c b/src/floor-generate.c index 3601e2524..338ffae8c 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -886,7 +886,7 @@ static bool cave_gen(floor_type *floor_ptr) /* Hack -- Add some quartz streamers */ for (i = 0; i < DUN_STR_QUA; i++) { - build_streamer(dungeon_ptr->stream2, DUN_STR_QC); + build_streamer(floor_ptr, dungeon_ptr->stream2, DUN_STR_QC); } } @@ -895,7 +895,7 @@ static bool cave_gen(floor_type *floor_ptr) /* Hack -- Add some magma streamers */ for (i = 0; i < DUN_STR_MAG; i++) { - build_streamer(dungeon_ptr->stream1, DUN_STR_MC); + build_streamer(floor_ptr, dungeon_ptr->stream1, DUN_STR_MC); } } } diff --git a/src/floor-streams.c b/src/floor-streams.c index 4516bd3ea..73404e176 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -144,7 +144,7 @@ static void recursive_river(floor_type *floor_ptr, POSITION x1, POSITION y1, POS /* Lava terrain glows */ if (have_flag(f_info[feat1].flags, FF_LAVA)) { - if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) g_ptr->info |= CAVE_GLOW; + if (!(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) g_ptr->info |= CAVE_GLOW; } /* Hack -- don't teleport here */ @@ -237,7 +237,7 @@ void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2) * hidden gold types are currently unused. * */ -void build_streamer(FEAT_IDX feat, int chance) +void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance) { int i; POSITION y, x, tx, ty; @@ -252,8 +252,8 @@ void build_streamer(FEAT_IDX feat, int chance) bool streamer_may_have_gold = have_flag(streamer_ptr->flags, FF_MAY_HAVE_GOLD); /* Hack -- Choose starting point */ - y = rand_spread(p_ptr->current_floor_ptr->height / 2, p_ptr->current_floor_ptr->height / 6); - x = rand_spread(p_ptr->current_floor_ptr->width / 2, p_ptr->current_floor_ptr->width / 6); + y = rand_spread(floor_ptr->height / 2, floor_ptr->height / 6); + x = rand_spread(floor_ptr->width / 2, floor_ptr->width / 6); /* Choose a random compass direction */ dir = randint0(8); @@ -273,10 +273,10 @@ void build_streamer(FEAT_IDX feat, int chance) { ty = rand_spread(y, d); tx = rand_spread(x, d); - if (!in_bounds2(p_ptr->current_floor_ptr, ty, tx)) continue; + if (!in_bounds2(floor_ptr, ty, tx)) continue; break; } - g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx]; + g_ptr = &floor_ptr->grid_array[ty][tx]; f_ptr = &f_info[g_ptr->feat]; if (have_flag(f_ptr->flags, FF_MOVE) && (have_flag(f_ptr->flags, FF_WATER) || have_flag(f_ptr->flags, FF_LAVA))) @@ -292,7 +292,7 @@ void build_streamer(FEAT_IDX feat, int chance) if (is_closed_door(g_ptr->feat)) continue; } - if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].r_idx], 0))) + if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[floor_ptr->m_list[g_ptr->m_idx].r_idx], 0))) { /* Delete the monster (if any) */ delete_monster(ty, tx); @@ -305,7 +305,7 @@ void build_streamer(FEAT_IDX feat, int chance) /* Scan all objects in the grid */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { - object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Hack -- Preserve unknown artifacts */ @@ -372,7 +372,7 @@ void build_streamer(FEAT_IDX feat, int chance) } /* Quit before leaving the dungeon */ - if (!in_bounds(p_ptr->current_floor_ptr, y, x)) break; + if (!in_bounds(floor_ptr, y, x)) break; } } diff --git a/src/floor-streams.h b/src/floor-streams.h index 6424fd652..fbe6dd89a 100644 --- a/src/floor-streams.h +++ b/src/floor-streams.h @@ -15,6 +15,6 @@ /* Externs */ extern void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2); -extern void build_streamer(FEAT_IDX feat, int chance); +extern void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance); extern void place_trees(floor_type *floor_ptr, POSITION x, POSITION y); extern void destroy_level(void); -- 2.11.0