From: Hourier Date: Sat, 18 Jan 2020 04:36:14 +0000 (+0900) Subject: [Refactor] #38997 update_monsters() にplayer_type * 引数追加 / Added player_type * argumen... X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=a5b94aa537ec54d9c2faca534a42c0a7088d8935 [Refactor] #38997 update_monsters() にplayer_type * 引数追加 / Added player_type * argument to update_monsters() --- 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); } }