OSDN Git Service

Merge pull request #1122 from habu1010/feature/fix-parse-m-info-spell-xtra
authorHabu <habu1010+github@gmail.com>
Wed, 19 May 2021 13:34:09 +0000 (22:34 +0900)
committerGitHub <noreply@github.com>
Wed, 19 May 2021 13:34:09 +0000 (22:34 +0900)
[Fix] m_info.txt の xtra フラグが正しく読めていない

src/info-reader/info-reader-util.h
src/info-reader/magic-reader.cpp

index 7f2a282..5f24971 100644 (file)
@@ -56,7 +56,7 @@ bool info_grab_one_flag(u32b *flags, const std::unordered_map<sview, T> &names,
  * @val 値
  */
 template <typename T>
-void info_set_value(T &arg, const std::string &val)
+void info_set_value(T &arg, const std::string &val, int base = 10)
 {
-    arg = static_cast<T>(std::stoi(val));
+    arg = static_cast<T>(std::stoi(val, nullptr, base));
 }
index a8d7d76..b926c7c 100644 (file)
@@ -75,7 +75,7 @@ errr parse_m_info(std::string_view buf, angband_header *head)
 
         m_ptr->spell_stat = stat->second;
 
-        info_set_value(m_ptr->spell_xtra, tokens[3]);
+        info_set_value(m_ptr->spell_xtra, tokens[3], 16);
         info_set_value(m_ptr->spell_type, tokens[4]);
         info_set_value(m_ptr->spell_first, tokens[5]);
         info_set_value(m_ptr->spell_weight, tokens[6]);