OSDN Git Service

[Refactor] #4127 MonsterRaceInfo::is_valid() を定義し、MonsterEntity::is_valid() と共にMonste...
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 1 Jun 2024 07:05:26 +0000 (16:05 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 2 Jun 2024 03:50:16 +0000 (12:50 +0900)
24 files changed:
src/birth/game-play-initializer.cpp
src/cmd-action/cmd-attack.cpp
src/effect/effect-monster.cpp
src/flavor/tval-description-switcher.cpp
src/io-dump/character-dump.cpp
src/knowledge/knowledge-uniques.cpp
src/main/game-data-initializer.cpp
src/market/building-monster.cpp
src/melee/monster-attack-monster.cpp
src/monster-attack/monster-attack-processor.cpp
src/monster-floor/monster-remover.cpp
src/monster-race/monster-race.cpp
src/monster/monster-compaction.cpp
src/monster/monster-list.cpp
src/monster/monster-processor.cpp
src/spell-kind/blood-curse.cpp
src/spell-kind/spells-pet.cpp
src/spell-kind/spells-teleport.cpp
src/system/monster-entity.cpp
src/system/monster-race-info.cpp
src/system/monster-race-info.h
src/window/display-sub-windows.cpp
src/window/main-window-left-frame.cpp
src/wizard/wizard-spoiler.cpp

index 7c965e0..e0e6506 100644 (file)
@@ -64,20 +64,20 @@ void player_wipe_without_name(PlayerType *player_ptr)
 
     ArtifactList::get_instance().reset_generated_flags();
     BaseitemList::get_instance().reset_identification_flags();
-    for (auto &[r_idx, r_ref] : monraces_info) {
-        if (!MonsterRace(r_ref.idx).is_valid()) {
+    for (auto &[_, monrace] : monraces_info) {
+        if (!monrace.is_valid()) {
             continue;
         }
-        r_ref.cur_num = 0;
-        r_ref.max_num = MAX_MONSTER_NUM;
-        if (r_ref.kind_flags.has(MonsterKindType::UNIQUE)) {
-            r_ref.max_num = MAX_UNIQUE_NUM;
-        } else if (r_ref.population_flags.has(MonsterPopulationType::NAZGUL)) {
-            r_ref.max_num = MAX_NAZGUL_NUM;
+        monrace.cur_num = 0;
+        monrace.max_num = MAX_MONSTER_NUM;
+        if (monrace.kind_flags.has(MonsterKindType::UNIQUE)) {
+            monrace.max_num = MAX_UNIQUE_NUM;
+        } else if (monrace.population_flags.has(MonsterPopulationType::NAZGUL)) {
+            monrace.max_num = MAX_NAZGUL_NUM;
         }
 
-        r_ref.r_pkills = 0;
-        r_ref.r_akills = 0;
+        monrace.r_pkills = 0;
+        monrace.r_akills = 0;
     }
 
     player_ptr->food = PY_FOOD_FULL - 1;
index df6dc37..6209b04 100644 (file)
@@ -136,7 +136,7 @@ static void natural_attack(PlayerType *player_ptr, MONSTER_IDX m_idx, PlayerMuta
     switch (attack) {
     case PlayerMutationType::SCOR_TAIL:
         project(player_ptr, 0, 0, m_ptr->fy, m_ptr->fx, k, AttributeType::POIS, PROJECT_KILL);
-        *mdeath = !MonsterRace(m_ptr->r_idx).is_valid();
+        *mdeath = !m_ptr->is_valid();
         break;
     case PlayerMutationType::HORNS:
     case PlayerMutationType::BEAK:
index c643ae8..93c999b 100644 (file)
@@ -751,7 +751,7 @@ bool affect_monster(
     exe_affect_monster_by_damage(player_ptr, em_ptr);
 
     update_phase_out_stat(player_ptr, em_ptr);
-    const auto monster_is_valid = MonsterRace(em_ptr->m_ptr->r_idx).is_valid();
+    const auto monster_is_valid = em_ptr->m_ptr->is_valid();
     if (monster_is_valid) {
         update_monster(player_ptr, target_m_idx, false);
     }
index 6b2c104..70eb3cd 100644 (file)
@@ -30,7 +30,7 @@ static std::pair<std::string, std::string> describe_monster_ball(const ItemEntit
         return { basename, "" };
     }
 
-    if (!MonsterRace(monrace_id).is_valid()) {
+    if (!monrace.is_valid()) {
         return { basename, _(" (空)", " (empty)") };
     }
 
index 8aee88a..8a04a76 100644 (file)
@@ -324,7 +324,7 @@ static void dump_aux_monsters(FILE *fff)
     auto norm_total = 0;
     for (const auto &[monrace_id, monrace] : monraces) {
         /* Ignore unused index */
-        if (!MonsterRace(monrace_id).is_valid()) {
+        if (!monrace.is_valid()) {
             continue;
         }
 
index a35b90d..f9c0f28 100644 (file)
@@ -133,16 +133,16 @@ void do_cmd_knowledge_uniques(PlayerType *player_ptr, bool is_alive)
         return;
     }
 
-    for (auto &[r_idx, r_ref] : monraces_info) {
-        if (!MonsterRace(r_ref.idx).is_valid()) {
+    for (auto &[monrace_id, monrace] : monraces_info) {
+        if (!monrace.is_valid()) {
             continue;
         }
-        if (!sweep_uniques(&r_ref, unique_list_ptr->is_alive)) {
+        if (!sweep_uniques(&monrace, unique_list_ptr->is_alive)) {
             continue;
         }
 
-        if (r_ref.level) {
-            int lev = (r_ref.level - 1) / 10;
+        if (monrace.level) {
+            int lev = (monrace.level - 1) / 10;
             if (lev < 10) {
                 unique_list_ptr->num_uniques[lev]++;
                 if (unique_list_ptr->max_lev < lev) {
@@ -155,7 +155,7 @@ void do_cmd_knowledge_uniques(PlayerType *player_ptr, bool is_alive)
             unique_list_ptr->num_uniques_surface++;
         }
 
-        unique_list_ptr->monrace_ids.push_back(r_ref.idx);
+        unique_list_ptr->monrace_ids.push_back(monrace_id);
     }
 
     const auto &monraces = MonraceList::get_instance();
index 1424b4f..9ec9d53 100644 (file)
@@ -96,9 +96,9 @@ void init_other(PlayerType *player_ptr)
 void init_monsters_alloc()
 {
     std::vector<const MonsterRaceInfo *> elements;
-    for (const auto &[r_idx, r_ref] : monraces_info) {
-        if (MonsterRace(r_ref.idx).is_valid()) {
-            elements.push_back(&r_ref);
+    for (const auto &[monrace_id, monrace] : monraces_info) {
+        if (monrace.is_valid()) {
+            elements.push_back(&monrace);
         }
     }
 
index daedda8..786edef 100644 (file)
@@ -74,7 +74,7 @@ bool research_mon(PlayerType *player_ptr)
     std::vector<MonsterRaceId> monrace_ids;
     const auto &monraces = MonraceList::get_instance();
     for (const auto &[monrace_id, monrace] : monraces) {
-        if (!MonsterRace(monrace_id).is_valid()) {
+        if (!monrace.is_valid()) {
             continue;
         }
 
index 292f128..4ee5da9 100644 (file)
@@ -84,14 +84,14 @@ static void process_blow_effect(PlayerType *player_ptr, mam_type *mam_ptr)
 
 static void aura_fire_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
 {
-    auto *r_ptr = &mam_ptr->m_ptr->get_monrace();
-    auto *tr_ptr = &mam_ptr->t_ptr->get_monrace();
-    if (tr_ptr->aura_flags.has_not(MonsterAuraType::FIRE) || !MonsterRace(mam_ptr->m_ptr->r_idx).is_valid()) {
+    auto &monrace = mam_ptr->m_ptr->get_monrace();
+    auto &monrace_target = mam_ptr->t_ptr->get_monrace();
+    if (monrace_target.aura_flags.has_not(MonsterAuraType::FIRE) || !mam_ptr->m_ptr->is_valid()) {
         return;
     }
 
-    if (r_ptr->resistance_flags.has_any_of(RFR_EFF_IM_FIRE_MASK) && is_original_ap_and_seen(player_ptr, mam_ptr->m_ptr)) {
-        r_ptr->r_resistance_flags.set(r_ptr->resistance_flags & RFR_EFF_IM_FIRE_MASK);
+    if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_FIRE_MASK) && is_original_ap_and_seen(player_ptr, mam_ptr->m_ptr)) {
+        monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_FIRE_MASK);
         return;
     }
 
@@ -100,25 +100,25 @@ static void aura_fire_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
     }
 
     if (mam_ptr->m_ptr->ml && is_original_ap_and_seen(player_ptr, mam_ptr->t_ptr)) {
-        tr_ptr->aura_flags.set(MonsterAuraType::FIRE);
+        monrace_target.aura_flags.set(MonsterAuraType::FIRE);
     }
 
-    const auto dam = damroll(1 + ((tr_ptr->level) / 26), 1 + ((tr_ptr->level) / 17));
+    const auto dam = damroll(1 + ((monrace_target.level) / 26), 1 + ((monrace_target.level) / 17));
     constexpr auto flags = PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED;
     project(player_ptr, mam_ptr->t_idx, 0, mam_ptr->m_ptr->fy, mam_ptr->m_ptr->fx, dam, AttributeType::FIRE, flags);
 }
 
 static void aura_cold_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
 {
-    const auto *m_ptr = mam_ptr->m_ptr;
-    auto *r_ptr = &m_ptr->get_monrace();
-    auto *tr_ptr = &mam_ptr->t_ptr->get_monrace();
-    if (tr_ptr->aura_flags.has_not(MonsterAuraType::COLD) || !MonsterRace(m_ptr->r_idx).is_valid()) {
+    const auto &monster = *mam_ptr->m_ptr;
+    auto &monrace = monster.get_monrace();
+    auto &monrace_target = mam_ptr->t_ptr->get_monrace();
+    if (monrace_target.aura_flags.has_not(MonsterAuraType::COLD) || !monster.is_valid()) {
         return;
     }
 
-    if (r_ptr->resistance_flags.has_any_of(RFR_EFF_IM_COLD_MASK) && is_original_ap_and_seen(player_ptr, m_ptr)) {
-        r_ptr->r_resistance_flags.set(r_ptr->resistance_flags & RFR_EFF_IM_COLD_MASK);
+    if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_COLD_MASK) && is_original_ap_and_seen(player_ptr, &monster)) {
+        monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_COLD_MASK);
         return;
     }
 
@@ -126,26 +126,26 @@ static void aura_cold_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
         msg_format(_("%s^は突然寒くなった!", "%s^ is suddenly very cold!"), mam_ptr->m_name);
     }
 
-    if (m_ptr->ml && is_original_ap_and_seen(player_ptr, mam_ptr->t_ptr)) {
-        tr_ptr->aura_flags.set(MonsterAuraType::COLD);
+    if (monster.ml && is_original_ap_and_seen(player_ptr, mam_ptr->t_ptr)) {
+        monrace_target.aura_flags.set(MonsterAuraType::COLD);
     }
 
-    const auto dam = damroll(1 + ((tr_ptr->level) / 26), 1 + ((tr_ptr->level) / 17));
+    const auto dam = damroll(1 + ((monrace_target.level) / 26), 1 + ((monrace_target.level) / 17));
     constexpr auto flags = PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED;
-    project(player_ptr, mam_ptr->t_idx, 0, m_ptr->fy, m_ptr->fx, dam, AttributeType::COLD, flags);
+    project(player_ptr, mam_ptr->t_idx, 0, monster.fy, monster.fx, dam, AttributeType::COLD, flags);
 }
 
 static void aura_elec_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
 {
-    const auto *m_ptr = mam_ptr->m_ptr;
-    auto *r_ptr = &m_ptr->get_monrace();
-    auto *tr_ptr = &mam_ptr->t_ptr->get_monrace();
-    if (tr_ptr->aura_flags.has_not(MonsterAuraType::ELEC) || !MonsterRace(m_ptr->r_idx).is_valid()) {
+    const auto &monster = *mam_ptr->m_ptr;
+    auto &monrace = monster.get_monrace();
+    auto &monrace_target = mam_ptr->t_ptr->get_monrace();
+    if (monrace_target.aura_flags.has_not(MonsterAuraType::ELEC) || !monster.is_valid()) {
         return;
     }
 
-    if (r_ptr->resistance_flags.has_any_of(RFR_EFF_IM_ELEC_MASK) && is_original_ap_and_seen(player_ptr, m_ptr)) {
-        r_ptr->r_resistance_flags.set(r_ptr->resistance_flags & RFR_EFF_IM_ELEC_MASK);
+    if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_ELEC_MASK) && is_original_ap_and_seen(player_ptr, &monster)) {
+        monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_ELEC_MASK);
         return;
     }
 
@@ -153,13 +153,13 @@ static void aura_elec_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
         msg_format(_("%s^は電撃を食らった!", "%s^ gets zapped!"), mam_ptr->m_name);
     }
 
-    if (m_ptr->ml && is_original_ap_and_seen(player_ptr, mam_ptr->t_ptr)) {
-        tr_ptr->aura_flags.set(MonsterAuraType::ELEC);
+    if (monster.ml && is_original_ap_and_seen(player_ptr, mam_ptr->t_ptr)) {
+        monrace_target.aura_flags.set(MonsterAuraType::ELEC);
     }
 
-    const auto dam = damroll(1 + ((tr_ptr->level) / 26), 1 + ((tr_ptr->level) / 17));
+    const auto dam = damroll(1 + ((monrace_target.level) / 26), 1 + ((monrace_target.level) / 17));
     constexpr auto flags = PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED;
-    project(player_ptr, mam_ptr->t_idx, 0, m_ptr->fy, m_ptr->fx, dam, AttributeType::ELEC, flags);
+    project(player_ptr, mam_ptr->t_idx, 0, monster.fy, monster.fx, dam, AttributeType::ELEC, flags);
 }
 
 static bool check_same_monster(PlayerType *player_ptr, mam_type *mam_ptr)
@@ -363,7 +363,7 @@ bool monst_attack_monst(PlayerType *player_ptr, MONSTER_IDX m_idx, MONSTER_IDX t
 
     repeat_melee(player_ptr, mam_ptr);
     explode_monster_by_melee(player_ptr, mam_ptr);
-    if (!mam_ptr->blinked || !MonsterRace(mam_ptr->m_ptr->r_idx).is_valid()) {
+    if (!mam_ptr->blinked || !mam_ptr->m_ptr->is_valid()) {
         return true;
     }
 
index 8a3ee14..26a0521 100644 (file)
@@ -75,20 +75,19 @@ void exe_monster_attack_to_player(PlayerType *player_ptr, turn_flags *turn_flags
  */
 static bool exe_monster_attack_to_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, Grid *g_ptr)
 {
-    auto &floor = *player_ptr->current_floor_ptr;
-    auto *m_ptr = &floor.m_list[m_idx];
-    auto *r_ptr = &m_ptr->get_monrace();
-    MonsterEntity *y_ptr;
-    y_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
-    if (r_ptr->behavior_flags.has(MonsterBehaviorType::NEVER_BLOW)) {
+    const auto &floor = *player_ptr->current_floor_ptr;
+    const auto &monster = floor.m_list[m_idx];
+    auto &monrace = monster.get_monrace();
+    const auto &monster_target = player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
+    if (monrace.behavior_flags.has(MonsterBehaviorType::NEVER_BLOW)) {
         return false;
     }
 
-    if ((r_ptr->behavior_flags.has_not(MonsterBehaviorType::KILL_BODY)) && is_original_ap_and_seen(player_ptr, m_ptr)) {
-        r_ptr->r_behavior_flags.set(MonsterBehaviorType::KILL_BODY);
+    if ((monrace.behavior_flags.has_not(MonsterBehaviorType::KILL_BODY)) && is_original_ap_and_seen(player_ptr, &monster)) {
+        monrace.r_behavior_flags.set(MonsterBehaviorType::KILL_BODY);
     }
 
-    if (!MonsterRace(y_ptr->r_idx).is_valid() || (y_ptr->hp < 0)) {
+    if (!monster_target.is_valid() || (monster_target.hp < 0)) {
         return false;
     }
     if (monst_attack_monst(player_ptr, m_idx, g_ptr->m_idx)) {
@@ -97,15 +96,15 @@ static bool exe_monster_attack_to_monster(PlayerType *player_ptr, MONSTER_IDX m_
     if (floor.get_dungeon_definition().flags.has_not(DungeonFeatureType::NO_MELEE)) {
         return false;
     }
-    if (m_ptr->is_confused()) {
+    if (monster.is_confused()) {
         return true;
     }
-    if (r_ptr->behavior_flags.has_not(MonsterBehaviorType::STUPID)) {
+    if (monrace.behavior_flags.has_not(MonsterBehaviorType::STUPID)) {
         return false;
     }
 
-    if (is_original_ap_and_seen(player_ptr, m_ptr)) {
-        r_ptr->r_behavior_flags.set(MonsterBehaviorType::STUPID);
+    if (is_original_ap_and_seen(player_ptr, &monster)) {
+        monrace.r_behavior_flags.set(MonsterBehaviorType::STUPID);
     }
 
     return true;
index 33e29f4..d31bc52 100644 (file)
@@ -88,9 +88,9 @@ void delete_monster_idx(PlayerType *player_ptr, MONSTER_IDX i)
     // 召喚元のモンスターが消滅した時は、召喚されたモンスターのparent_m_idxが
     // 召喚されたモンスター自身のm_idxを指すようにする
     for (MONSTER_IDX child_m_idx = 1; child_m_idx < floor_ptr->m_max; child_m_idx++) {
-        MonsterEntity *child_m_ptr = &floor_ptr->m_list[child_m_idx];
-        if (MonsterRace(child_m_ptr->r_idx).is_valid() && child_m_ptr->parent_m_idx == i) {
-            child_m_ptr->parent_m_idx = child_m_idx;
+        auto &child_monster = floor_ptr->m_list[child_m_idx];
+        if (child_monster.is_valid() && child_monster.parent_m_idx == i) {
+            child_monster.parent_m_idx = child_m_idx;
         }
     }
 
index fadd072..d5cd2fc 100644 (file)
@@ -39,9 +39,9 @@ MonsterRaceId MonsterRace::pick_one_at_random()
     static ProbabilityTable<MonsterRaceId> table;
 
     if (table.empty()) {
-        for (const auto &[r_idx, r_ref] : monraces_info) {
-            if (MonsterRace(r_idx).is_valid()) {
-                table.entry_item(r_idx, 1);
+        for (const auto &[monrace_id, monrace] : monraces_info) {
+            if (monrace.is_valid()) {
+                table.entry_item(monrace_id, 1);
             }
         }
     }
index 9a30a9c..54c1eb5 100644 (file)
@@ -151,8 +151,8 @@ void compact_monsters(PlayerType *player_ptr, int size)
 
     /* Excise dead monsters (backwards!) */
     for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--) {
-        auto *m_ptr = &floor_ptr->m_list[i];
-        if (MonsterRace(m_ptr->r_idx).is_valid()) {
+        const auto &monster = floor_ptr->m_list[i];
+        if (monster.is_valid()) {
             continue;
         }
         compact_monsters_aux(player_ptr, floor_ptr->m_max - 1, i);
index dbb4f6f..e70edcf 100644 (file)
@@ -68,7 +68,7 @@ MONSTER_IDX m_pop(FloorType *floor_ptr)
     /* Recycle dead monsters */
     for (short i = 1; i < floor_ptr->m_max; i++) {
         const auto &monster = floor_ptr->m_list[i];
-        if (MonsterRace(monster.r_idx).is_valid()) {
+        if (monster.is_valid()) {
             continue;
         }
 
index 0cd8020..2dfa8b3 100644 (file)
@@ -280,7 +280,7 @@ bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool se
     }
 
     // parent_m_idxが自分自身を指している場合は召喚主は消滅している
-    if (m_ptr->parent_m_idx != m_idx && MonsterRace(player_ptr->current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx).is_valid()) {
+    if (m_ptr->parent_m_idx != m_idx && player_ptr->current_floor_ptr->m_list[m_ptr->parent_m_idx].is_valid()) {
         return false;
     }
 
index e88d1ba..2c821d9 100644 (file)
@@ -55,7 +55,7 @@ void blood_curse_to_enemy(PlayerType *player_ptr, MONSTER_IDX m_idx)
         case 8:
             if (!count) {
                 msg_print(_("空間が歪んだ!", "Space warps about you!"));
-                if (MonsterRace(m_ptr->r_idx).is_valid()) {
+                if (m_ptr->is_valid()) {
                     teleport_away(player_ptr, g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
                 }
                 if (one_in_(13)) {
index da73c0d..e793c22 100644 (file)
@@ -25,7 +25,7 @@ void discharge_minion(PlayerType *player_ptr)
     bool okay = true;
     for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
         auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
-        if (!MonsterRace(m_ptr->r_idx).is_valid() || !m_ptr->is_pet()) {
+        if (!m_ptr->is_valid() || !m_ptr->is_pet()) {
             continue;
         }
         if (m_ptr->is_named()) {
@@ -41,7 +41,7 @@ void discharge_minion(PlayerType *player_ptr)
 
     for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
         auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
-        if (!MonsterRace(m_ptr->r_idx).is_valid() || !m_ptr->is_pet()) {
+        if (!m_ptr->is_valid() || !m_ptr->is_pet()) {
             continue;
         }
 
index 7291136..f53f645 100644 (file)
@@ -204,7 +204,7 @@ bool teleport_away(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION dis, tele
 void teleport_monster_to(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, teleport_flags mode)
 {
     auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
-    if (!MonsterRace(m_ptr->r_idx).is_valid()) {
+    if (!m_ptr->is_valid()) {
         return;
     }
     if (randint1(100) > power) {
index 7ec4c09..ac965bd 100644 (file)
@@ -137,7 +137,7 @@ bool MonsterEntity::is_mimicry() const
 
 bool MonsterEntity::is_valid() const
 {
-    return MonsterRace(this->r_idx).is_valid();
+    return MonraceList::is_valid(this->r_idx);
 }
 
 MonsterRaceId MonsterEntity::get_real_monrace_id() const
index 8d63053..a0786e2 100644 (file)
@@ -10,6 +10,14 @@ MonsterRaceInfo::MonsterRaceInfo()
 }
 
 /*!
+ * @todo 将来的に定義側のIDが廃止されたら有効フラグのフィールド変数を代わりに作る.
+ */
+bool MonsterRaceInfo::is_valid() const
+{
+    return this->idx != MonsterRaceId::PLAYER;
+}
+
+/*!
  * @brief エルドリッチホラーの形容詞種別を決める
  * @return エルドリッチホラーの形容詞
  */
index 2a96ae8..3a746e8 100644 (file)
@@ -139,6 +139,7 @@ public:
     REAL_TIME defeat_time{}; //!< 倒した時間(ユニーク用) / time at which defeated this race
     PERCENTAGE cur_hp_per{}; //!< 生成時現在HP率(%)
 
+    bool is_valid() const;
     const std::string &decide_horror_message() const;
     bool has_living_flag() const;
     bool is_explodable() const;
index 3b6974a..f6d073f 100644 (file)
@@ -181,7 +181,7 @@ void print_monster_list(FloorType *floor_ptr, const std::vector<MONSTER_IDX> &mo
         if (m_ptr->is_pet()) {
             continue;
         } // pet
-        if (!MonsterRace(m_ptr->r_idx).is_valid()) {
+        if (!m_ptr->is_valid()) {
             continue;
         } // dead?
 
index df0b1ae..b590f35 100644 (file)
@@ -284,7 +284,7 @@ static void print_health_monster_in_arena_for_wizard(PlayerType *player_ptr)
         term_putstr(col - 2, row + row_offset, 12, TERM_WHITE, "      /     ");
 
         auto &monster = player_ptr->current_floor_ptr->m_list[monster_list_index];
-        if (MonsterRace(monster.r_idx).is_valid()) {
+        if (monster.is_valid()) {
             const auto &monrace = monster.get_monrace();
             const auto &symbol_config = monrace.symbol_config;
             term_putstr(col - 2, row + row_offset, 2, symbol_config.color, format("%c", symbol_config.character));
index a0ce3d7..6afae1a 100644 (file)
@@ -62,10 +62,10 @@ static auto get_mon_evol_roots()
 {
     std::set<MonsterRaceId> evol_parents;
     std::set<MonsterRaceId> evol_children;
-    for (const auto &[r_idx, r_ref] : monraces_info) {
-        if (MonsterRace(r_ref.next_r_idx).is_valid()) {
-            evol_parents.emplace(r_ref.idx);
-            evol_children.emplace(r_ref.next_r_idx);
+    for (const auto &[monrace_id, monrace] : monraces_info) {
+        if (MonsterRace(monrace.next_r_idx).is_valid()) {
+            evol_parents.emplace(monrace_id);
+            evol_children.emplace(monrace.next_r_idx);
         }
     }