From a5b94aa537ec54d9c2faca534a42c0a7088d8935 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sat, 18 Jan 2020 13:36:14 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20update=5Fmonsters()=20?= =?utf8?q?=E3=81=ABplayer=5Ftype=20*=20=E5=BC=95=E6=95=B0=E8=BF=BD?= =?utf8?q?=E5=8A=A0=20/=20Added=20player=5Ftype=20*=20argument=20to=20upda?= =?utf8?q?te=5Fmonsters()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/monster.h | 2 +- src/monster2.c | 7 ++++--- src/player-status.c | 7 ++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/monster.h b/src/monster.h index 8112a132d..7dea535b7 100644 --- a/src/monster.h +++ b/src/monster.h @@ -477,7 +477,7 @@ extern MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level); extern int lore_do_probe(player_type *player_ptr, MONRACE_IDX r_idx); extern void lore_treasure(player_type *player_ptr, MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold); extern void update_monster(player_type *subject_ptr, MONSTER_IDX m_idx, bool full); -extern void update_monsters(bool full); +extern void update_monsters(player_type *player_ptr, bool full); extern bool multiply_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode); extern bool summon_specific(player_type *player_ptr, MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, int type, BIT_FLAGS mode); extern bool summon_named_creature(player_type *player_ptr, MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_IDX r_idx, BIT_FLAGS mode); diff --git a/src/monster2.c b/src/monster2.c index 608fb41a0..1a68433cc 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -2205,21 +2205,22 @@ void update_monster(player_type *subject_ptr, MONSTER_IDX m_idx, bool full) /*! + * @param player_ptr プレーヤーへの参照ポインタ * @brief 単純に生存している全モンスターの更新処理を行う / This function simply updates all the (non-dead) monsters (see above). * @param full 距離更新を行うならtrue * @return なし */ -void update_monsters(bool full) +void update_monsters(player_type *player_ptr, bool full) { MONSTER_IDX i; /* Update each (live) monster */ - floor_type *floor_ptr = p_ptr->current_floor_ptr; + floor_type *floor_ptr = player_ptr->current_floor_ptr; for (i = 1; i < floor_ptr->m_max; i++) { monster_type *m_ptr = &floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; - update_monster(p_ptr, i, full); + update_monster(player_ptr, i, full); } } diff --git a/src/player-status.c b/src/player-status.c index d51f0a46d..e103ab487 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -4992,10 +4992,7 @@ void update_creature(player_type *creature_ptr) { creature_ptr->update &= ~(PU_DISTANCE); - /* Still need to call update_monsters(FALSE) after update_mon_lite() */ - /* creature_ptr->update &= ~(PU_MONSTERS); */ - - update_monsters(TRUE); + update_monsters(creature_ptr, TRUE); } if (creature_ptr->update & (PU_MON_LITE)) @@ -5017,7 +5014,7 @@ void update_creature(player_type *creature_ptr) if (creature_ptr->update & (PU_MONSTERS)) { creature_ptr->update &= ~(PU_MONSTERS); - update_monsters(FALSE); + update_monsters(creature_ptr, FALSE); } } -- 2.11.0