OSDN Git Service

[Refactor] トークン定義を出現数上限フラグの再定義に合わせる
authorSlimebreath6078 <slimebreath6078@yahoo.co.jp>
Fri, 15 Apr 2022 13:25:10 +0000 (22:25 +0900)
committerSlimebreath6078 <slimebreath6078@yahoo.co.jp>
Thu, 14 Jul 2022 14:13:33 +0000 (23:13 +0900)
src/info-reader/dungeon-reader.cpp
src/info-reader/race-info-tokens-table.cpp
src/info-reader/race-info-tokens-table.h
src/info-reader/race-reader.cpp

index be954eb..8709aef 100644 (file)
@@ -85,6 +85,10 @@ static bool grab_one_basic_monster_flag(dungeon_type *d_ptr, std::string_view wh
         return true;
     }
 
+    if (EnumClassFlagGroup<MonsterPopulationType>::grab_one_flag(d_ptr->mon_population_flags, r_info_population_flags, what)) {
+        return true;
+    }
+
     msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what.data());
     return false;
 }
index c2d6d1f..d5f280d 100644 (file)
@@ -5,6 +5,7 @@
 #include "monster-race/race-drop-flags.h"
 #include "monster-race/race-feature-flags.h"
 #include "monster-race/race-kind-flags.h"
+#include "monster-race/race-population-flags.h"
 #include "monster-race/race-visual-flags.h"
 #include "monster-race/race-wilderness-flags.h"
 
@@ -251,7 +252,6 @@ const std::unordered_map<std::string_view, MonsterAbilityType> r_info_ability_fl
  * "GUARDIAN" ... init.c d_infoの FINAL_GUARDIAN_* にて自動指定
  */
 const std::unordered_map<std::string_view, race_flags7> r_info_flags7 = {
-    { "NAZGUL", RF7_NAZGUL },
     { "UNIQUE2", RF7_UNIQUE2 },
     { "RIDING", RF7_RIDING },
     { "KAGE", RF7_KAGE },
@@ -440,3 +440,7 @@ const std::unordered_map<std::string_view, MonsterFeatureType> r_info_feature_fl
     { "CAN_SWIM", MonsterFeatureType::CAN_SWIM },
     { "CAN_FLY", MonsterFeatureType::CAN_FLY },
 };
+
+const std::unordered_map<std::string_view, MonsterPopulationType> r_info_population_flags = {
+    { "NAZGUL", MonsterPopulationType::NAZGUL },
+};
index 29925f8..b3cb35b 100644 (file)
@@ -14,6 +14,7 @@
 #include "monster-race/race-flags7.h"
 #include "monster-race/race-flags8.h"
 #include "monster-race/race-kind-flags.h"
+#include "monster-race/race-population-flags.h"
 #include "monster-race/race-visual-flags.h"
 #include "monster-race/race-wilderness-flags.h"
 #include "system/angband.h"
@@ -39,3 +40,4 @@ extern const std::unordered_map<std::string_view, MonsterKindType> r_info_kind_f
 extern const std::unordered_map<std::string_view, MonsterDropType> r_info_drop_flags;
 extern const std::unordered_map<std::string_view, MonsterWildernessType> r_info_wilderness_flags;
 extern const std::unordered_map<std::string_view, MonsterFeatureType> r_info_feature_flags;
+extern const std::unordered_map<std::string_view, MonsterPopulationType> r_info_population_flags;
index 224822b..97b2792 100644 (file)
@@ -72,6 +72,10 @@ static bool grab_one_basic_flag(monster_race *r_ptr, std::string_view what)
         return true;
     }
 
+    if (EnumClassFlagGroup<MonsterPopulationType>::grab_one_flag(r_ptr->population_flags, r_info_population_flags, what)) {
+        return true;
+    }
+
     msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what.data());
     return false;
 }