OSDN Git Service

[Refactor] #3640 'monraces_info[monster.r_idx]' を厳密一致で'monster.get_monrace()' に差し替えた
authorHourier <66951241+Hourier@users.noreply.github.com>
Sun, 8 Oct 2023 13:50:07 +0000 (22:50 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 15 Oct 2023 11:04:17 +0000 (20:04 +0900)
src/action/mutation-execution.cpp
src/monster/monster-pain-describer.cpp
src/player/player-skill.cpp
src/window/main-window-left-frame.cpp

index aae4d58..a199aa7 100644 (file)
@@ -255,7 +255,7 @@ bool exe_mutation_power(PlayerType *player_ptr, PlayerMutationType power)
         }
 
         auto &monster = floor.m_list[grid.m_idx];
-        const auto &monrace = monraces_info[monster.r_idx];
+        const auto &monrace = monster.get_monrace();
         auto can_banish = monrace.kind_flags.has(MonsterKindType::EVIL);
         can_banish &= none_bits(monrace.flags1, RF1_QUESTOR);
         can_banish &= monrace.kind_flags.has_not(MonsterKindType::UNIQUE);
index 26efcbb..795431a 100644 (file)
@@ -28,8 +28,8 @@ struct pain_message_type {
 static auto d_char_is_any_of(concptr symbols)
 {
     return [symbols](const MonsterEntity &monster) {
-        const auto &m_info = monraces_info[monster.r_idx];
-        return angband_strchr(symbols, m_info.d_char) != nullptr;
+        const auto &monrace = monster.get_monrace();
+        return angband_strchr(symbols, monrace.d_char) != nullptr;
     };
 }
 
@@ -65,8 +65,8 @@ static const std::vector<pain_message_type> pain_messages{
             { 0, _("はくしゃくしゃになった。", " crumples.") },
         } },
     { [](const MonsterEntity &monster) {
-        const auto &m_info = monraces_info[monster.r_idx];
-        return d_char_is_any_of("JMR")(monster) || !isalpha(m_info.d_char); },
+        const auto &monrace = monster.get_monrace();
+        return d_char_is_any_of("JMR")(monster) || !isalpha(monrace.d_char); },
         {
             { 95, _("はほとんど気にとめていない。", " barely notices.") },
             { 75, _("はシーッと鳴いた。", " hisses.") },
index 4fc7dc8..a3b80d8 100644 (file)
@@ -319,7 +319,7 @@ void PlayerSkill::gain_riding_skill_exp_on_range_attack()
 
     const auto *floor_ptr = this->player_ptr->current_floor_ptr;
     const auto &monster = floor_ptr->m_list[this->player_ptr->riding];
-    const auto &monrace = monraces_info[monster.r_idx];
+    const auto &monrace = monster.get_monrace();
     if (((this->player_ptr->skill_exp[PlayerSkillKindType::RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < monrace.level) && one_in_(2)) {
         this->player_ptr->skill_exp[PlayerSkillKindType::RIDING] += 1;
         RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::BONUS);
index 9eef636..dfc5927 100644 (file)
@@ -285,8 +285,9 @@ static void print_health_monster_in_arena_for_wizard(PlayerType *player_ptr)
 
         auto &monster = player_ptr->current_floor_ptr->m_list[monster_list_index];
         if (MonsterRace(monster.r_idx).is_valid()) {
-            term_putstr(col - 2, row + row_offset, 2, monraces_info[monster.r_idx].x_attr,
-                format("%c", monraces_info[monster.r_idx].x_char));
+            const auto &monrace = monster.get_monrace();
+            term_putstr(col - 2, row + row_offset, 2, monrace.x_attr,
+                format("%c", monrace.x_char));
             term_putstr(col - 1, row + row_offset, 5, TERM_WHITE, format("%5d", monster.hp));
             term_putstr(col + 5, row + row_offset, 6, TERM_WHITE, format("%5d", monster.max_maxhp));
         }