OSDN Git Service

[Refactor] #2647 get_real_r_idx() を整形した
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 17 Sep 2022 04:04:13 +0000 (13:04 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 18 Sep 2022 11:06:53 +0000 (20:06 +0900)
src/system/monster-type-definition.cpp

index e9b73a5..532b108 100644 (file)
@@ -63,14 +63,10 @@ bool monster_type::is_valid() const
 
 MonsterRaceId monster_type::get_real_r_idx() const
 {
-    auto *r_ptr = &r_info[this->r_idx];
-    if (this->mflag2.has(MonsterConstantFlagType::CHAMELEON)) {
-        if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
-            return MonsterRaceId::CHAMELEON_K;
-        } else {
-            return MonsterRaceId::CHAMELEON;
-        }
+    const auto &r_ref = r_info[this->r_idx];
+    if (this->mflag2.has_not(MonsterConstantFlagType::CHAMELEON)) {
+        return this->r_idx;
     }
 
-    return this->r_idx;
+    return r_ref.kind_flags.has(MonsterKindType::UNIQUE) ? MonsterRaceId::CHAMELEON_K : MonsterRaceId::CHAMELEON;
 }