From: Hourier Date: Thu, 11 Jun 2020 10:32:16 +0000 (+0900) Subject: [Refactor] #40014 Changed argument type in get_monster_crowd_number() from player_typ... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=aa9b892283a022858957e8f1fb9dfa73b862aa08;p=hengband%2Fhengband.git [Refactor] #40014 Changed argument type in get_monster_crowd_number() from player_type* to floor_type* --- diff --git a/src/floor/floor-events.c b/src/floor/floor-events.c index 2f47e69f6..df0827268 100644 --- a/src/floor/floor-events.c +++ b/src/floor/floor-events.c @@ -27,7 +27,6 @@ static bool mon_invis; static POSITION mon_fy, mon_fx; -byte get_dungeon_feeling(player_type *subject_ptr); void day_break(player_type *subject_ptr) { @@ -149,10 +148,9 @@ MONSTER_NUMBER count_all_hostile_monsters(floor_type *floor_ptr) * / Examine all monsters and unidentified objects, and get the feeling of current dungeon floor * @return 算出されたダンジョンの雰囲気ランク */ -byte get_dungeon_feeling(player_type *subject_ptr) +byte get_dungeon_feeling(floor_type *floor_ptr) { /* Hack -- no feeling in the town */ - floor_type *floor_ptr = subject_ptr->current_floor_ptr; if (!floor_ptr->dun_level) return 0; /* Examine each monster */ @@ -191,11 +189,11 @@ byte get_dungeon_feeling(player_type *subject_ptr) /* Unusually crowded monsters get a little bit of rating boost */ if (r_ptr->flags1 & RF1_FRIENDS) { - if (5 <= get_monster_crowd_number(subject_ptr, i)) delta += 1; + if (5 <= get_monster_crowd_number(floor_ptr, i)) delta += 1; } else { - if (2 <= get_monster_crowd_number(subject_ptr, i)) delta += 1; + if (2 <= get_monster_crowd_number(floor_ptr, i)) delta += 1; } @@ -305,7 +303,7 @@ void update_dungeon_feeling(player_type *subject_ptr) /* Get new dungeon feeling */ - byte new_feeling = get_dungeon_feeling(subject_ptr); + byte new_feeling = get_dungeon_feeling(floor_ptr); /* Remember last time updated */ subject_ptr->feeling_turn = current_world_ptr->game_turn; diff --git a/src/monster/monster2.c b/src/monster/monster2.c index bf3a77eab..28e40d0bd 100644 --- a/src/monster/monster2.c +++ b/src/monster/monster2.c @@ -617,16 +617,14 @@ void monster_drop_carried_objects(player_type *player_ptr, monster_type *m_ptr) } /*! - * todo ここには本来floor_type*を追加したいが、monster.hにfloor.hの参照を追加するとコンパイルエラーが出るので保留 * @brief 指定したモンスターに隣接しているモンスターの数を返す。 * / Count number of adjacent monsters * @param player_ptr プレーヤーへの参照ポインタ * @param m_idx 隣接数を調べたいモンスターのID * @return 隣接しているモンスターの数 */ -int get_monster_crowd_number(player_type *player_ptr, MONSTER_IDX m_idx) +int get_monster_crowd_number(floor_type *floor_ptr, MONSTER_IDX m_idx) { - floor_type *floor_ptr = player_ptr->current_floor_ptr; monster_type *m_ptr = &floor_ptr->m_list[m_idx]; POSITION my = m_ptr->fy; POSITION mx = m_ptr->fx; diff --git a/src/monster/monster2.h b/src/monster/monster2.h index 654a7ecc1..e6f9d153d 100644 --- a/src/monster/monster2.h +++ b/src/monster/monster2.h @@ -1,6 +1,7 @@ #pragma once #include "system/angband.h" +#include "floor/floor.h" #include "system/monster-type-definition.h" void set_target(monster_type *m_ptr, POSITION y, POSITION x); @@ -14,5 +15,5 @@ void choose_new_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool born, M SPEED get_mspeed(player_type *player_ptr, monster_race *r_ptr); void monster_drop_carried_objects(player_type *player_ptr, monster_type *m_ptr); -int get_monster_crowd_number(player_type *player_ptr, MONSTER_IDX m_idx); +int get_monster_crowd_number(floor_type *floor_ptr, MONSTER_IDX m_idx); void monster_name(player_type *player_ptr, MONSTER_IDX m_idx, char *m_name);