OSDN Git Service

[Refactor]フラグ読み込み関数にも適用させる
authorSlimebreath6078 <slimebreath6078@yahoo.co.jp>
Sun, 29 Oct 2023 15:21:36 +0000 (00:21 +0900)
committerSlimebreath6078 <slimebreath6078@yahoo.co.jp>
Wed, 1 Nov 2023 10:26:16 +0000 (19:26 +0900)
src/util/flag-group.h

index e59cc3d..462b04b 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+#include "info-reader/info-reader-util.h"
 #include <bitset>
 #include <concepts>
 #include <iterator>
@@ -592,13 +593,12 @@ public:
     template <typename Map>
     static bool grab_one_flag(FlagGroup<FlagType, MAX> &fg, const Map &dict, std::string_view what)
     {
-        auto it = dict.find(what);
-        if (it == dict.end()) {
-            return false;
+        auto val = info_get_const<FlagType>(dict, what);
+        if (val) {
+            fg.set(*val);
+            return true;
         }
-
-        fg.set(it->second);
-        return true;
+        return false;
     }
 
 private: