From b69cf6a964cc8bd2b724849f3f419901abcf2f2a Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 11 Nov 2019 08:38:02 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20place=5Fquest=5Fmonsters()?= =?utf8?q?=20=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=20place=5Fquest=5Fmonsters().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor-generate.c | 10 ++++++---- src/floor-generate.h | 2 +- src/floor-save.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/floor-generate.c b/src/floor-generate.c index d4b4c0bc6..4ff532365 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -392,9 +392,11 @@ static void alloc_object(floor_type *floor_ptr, int set, EFFECT_ID typ, int num) /*! * @brief クエストに関わるモンスターの配置を行う / Place quest monsters + * @param floor_ptr 配置するフロアの参照ポインタ + * @param subject_ptr 近隣への即出現を避けるためのプレイヤークリーチャー参照ポインタ * @return 成功したならばTRUEを返す */ -bool place_quest_monsters(floor_type *floor_ptr) +bool place_quest_monsters(floor_type *floor_ptr, player_type *creature_ptr) { int i; @@ -409,7 +411,7 @@ bool place_quest_monsters(floor_type *floor_ptr) (quest[i].type != QUEST_TYPE_KILL_LEVEL && quest[i].type != QUEST_TYPE_RANDOM) || quest[i].level != floor_ptr->dun_level || - p_ptr->dungeon_idx != quest[i].dungeon || + creature_ptr->dungeon_idx != quest[i].dungeon || (quest[i].flags & QUEST_FLAG_PRESET)) { /* Ignore it */ @@ -450,7 +452,7 @@ bool place_quest_monsters(floor_type *floor_ptr) if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) continue; if (!monster_can_enter(y, x, r_ptr, 0)) continue; - if (distance(y, x, p_ptr->y, p_ptr->x) < 10) continue; + if (distance(y, x, creature_ptr->y, creature_ptr->x) < 10) continue; if (g_ptr->info & CAVE_ICKY) continue; else break; } @@ -915,7 +917,7 @@ static bool cave_gen(floor_type *floor_ptr) /* Determine the character location */ if (!new_player_spot()) return FALSE; - if (!place_quest_monsters(floor_ptr)) return FALSE; + if (!place_quest_monsters(floor_ptr, p_ptr)) return FALSE; /* Basic "amount" */ k = (floor_ptr->dun_level / 3); diff --git a/src/floor-generate.h b/src/floor-generate.h index 512868c85..99b802c9f 100644 --- a/src/floor-generate.h +++ b/src/floor-generate.h @@ -100,7 +100,7 @@ struct dun_data extern dun_data *dun; -extern bool place_quest_monsters(floor_type *floor_ptr); +extern bool place_quest_monsters(floor_type *floor_ptr, player_type *creature_ptr); extern void wipe_generate_random_floor_flags(floor_type *floor_ptr); extern void clear_cave(floor_type *floor_ptr); extern void generate_floor(floor_type *floor_ptr); diff --git a/src/floor-save.c b/src/floor-save.c index fe3c2fd3f..e6a106e82 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -1270,7 +1270,7 @@ void change_floor(player_type *creature_ptr) } } - (void)place_quest_monsters(creature_ptr->current_floor_ptr); + (void)place_quest_monsters(creature_ptr->current_floor_ptr, creature_ptr); /* Place some random monsters */ alloc_times = absence_ticks / alloc_chance; -- 2.11.0