From 1075da8e1a92d2533bfcdba4906f90427c0c6e50 Mon Sep 17 00:00:00 2001 From: deskull Date: Tue, 31 Dec 2019 10:06:48 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20wilderness=5Fgen()=20?= =?utf8?q?=E3=81=AB=20player=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=20player=5Ftype=20*=20argu?= =?utf8?q?ment=20to=20wilderness=5Fgen().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor-generate.c | 2 +- src/wild.c | 31 ++++++++++++++++--------------- src/wild.h | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/floor-generate.c b/src/floor-generate.c index b98750535..e711ad51d 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -1437,7 +1437,7 @@ void generate_floor(floor_type *floor_ptr) { /* Make the wilderness */ if (p_ptr->wild_mode) wilderness_gen_small(p_ptr, floor_ptr); - else wilderness_gen(floor_ptr); + else wilderness_gen(p_ptr, floor_ptr); } /* Build a real level */ diff --git a/src/wild.c b/src/wild.c index cd5d7ea8c..879c04475 100644 --- a/src/wild.c +++ b/src/wild.c @@ -467,9 +467,10 @@ static border_type border; /*! * @brief 広域マップの生成 / * Build the wilderness area outside of the town. + * @todo 広域マップは恒常生成にする予定、player_typeによる処理分岐は最終的に排除する。 * @return なし */ -void wilderness_gen(floor_type *floor_ptr) +void wilderness_gen(player_type *creature_ptr, floor_type *floor_ptr) { int i, lim; POSITION y, x; @@ -485,8 +486,8 @@ void wilderness_gen(floor_type *floor_ptr) panel_col_min = floor_ptr->width; process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); - x = p_ptr->wilderness_x; - y = p_ptr->wilderness_y; + x = creature_ptr->wilderness_x; + y = creature_ptr->wilderness_y; get_mon_num_prep(get_monster_hook(), NULL); /* North border */ @@ -627,7 +628,7 @@ void wilderness_gen(floor_type *floor_ptr) } } - if (p_ptr->teleport_town) + if (creature_ptr->teleport_town) { for (y = 0; y < floor_ptr->height; y++) { @@ -640,19 +641,19 @@ void wilderness_gen(floor_type *floor_ptr) if (have_flag(f_ptr->flags, FF_BLDG)) { - if ((f_ptr->subtype == 4) || ((p_ptr->town_num == 1) && (f_ptr->subtype == 0))) + if ((f_ptr->subtype == 4) || ((creature_ptr->town_num == 1) && (f_ptr->subtype == 0))) { if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); - p_ptr->oldpy = y; - p_ptr->oldpx = x; + creature_ptr->oldpy = y; + creature_ptr->oldpx = x; } } } } - p_ptr->teleport_town = FALSE; + creature_ptr->teleport_town = FALSE; } - else if (p_ptr->leaving_dungeon) + else if (creature_ptr->leaving_dungeon) { for (y = 0; y < floor_ptr->height; y++) { @@ -663,15 +664,15 @@ void wilderness_gen(floor_type *floor_ptr) if (cave_have_flag_grid(g_ptr, FF_ENTRANCE)) { if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); - p_ptr->oldpy = y; - p_ptr->oldpx = x; + creature_ptr->oldpy = y; + creature_ptr->oldpx = x; } } } - p_ptr->teleport_town = FALSE; + creature_ptr->teleport_town = FALSE; } - player_place(p_ptr, p_ptr->oldpy, p_ptr->oldpx); + player_place(creature_ptr, creature_ptr->oldpy, creature_ptr->oldpx); lim = (generate_encounter == TRUE) ? 40 : MIN_M_ALLOC_TN; @@ -680,14 +681,14 @@ void wilderness_gen(floor_type *floor_ptr) { BIT_FLAGS mode = 0; - if (!(generate_encounter || (one_in_(2) && (!p_ptr->town_num)))) + if (!(generate_encounter || (one_in_(2) && (!creature_ptr->town_num)))) mode |= PM_ALLOW_SLEEP; /* Make a resident */ (void)alloc_monster(generate_encounter ? 0 : 3, mode); } - if(generate_encounter) p_ptr->ambush_flag = TRUE; + if(generate_encounter) creature_ptr->ambush_flag = TRUE; generate_encounter = FALSE; /* Fill the arrays of floors and walls in the good proportions */ diff --git a/src/wild.h b/src/wild.h index 7da9360a1..7e46d078a 100644 --- a/src/wild.h +++ b/src/wild.h @@ -26,7 +26,7 @@ /* wild.c */ extern void set_floor_and_wall(DUNGEON_IDX type); -extern void wilderness_gen(floor_type *floor_ptr); +extern void wilderness_gen(player_type *creature_ptr, floor_type *floor_ptr); extern void wilderness_gen_small(player_type *creature_ptr, floor_type *floor_ptr); extern errr init_wilderness(void); extern void init_wilderness_terrains(void); -- 2.11.0