OSDN Git Service

Merge pull request #3616 from Hourier/Change-Artifacts-Spoiler-Signature
authorHourier <66951241+Hourier@users.noreply.github.com>
Sun, 15 Oct 2023 10:46:09 +0000 (19:46 +0900)
committerGitHub <noreply@github.com>
Sun, 15 Oct 2023 10:46:09 +0000 (19:46 +0900)
アーティファクトの出力スポイラー処理に関わる設計を改善した その1

72 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/artifact/random-art-characteristics.cpp
src/artifact/random-art-generator.cpp
src/cmd-item/cmd-equipment.cpp
src/cmd-item/cmd-refill.cpp
src/combat/shoot.cpp
src/combat/slaying.cpp
src/effect/effect-item.cpp
src/flavor/flavor-describer.cpp
src/flavor/flavor-util.cpp
src/flavor/named-item-describer.cpp
src/flavor/object-flavor.cpp
src/hpmp/hp-mp-processor.cpp
src/inventory/inventory-curse.cpp
src/io-dump/random-art-info-dumper.cpp
src/knowledge/knowledge-inventory.cpp
src/load/old/item-loader-savefile50.cpp
src/market/building-craft-fix.cpp
src/market/building-craft-weapon.cpp
src/mind/mind-priest.cpp
src/monster-floor/monster-object.cpp
src/object-activation/activation-breath.cpp
src/object-enchant/object-curse.cpp
src/object-hook/hook-magic.cpp
src/object-hook/hook-weapon.cpp
src/object-use/throw-execution.cpp
src/object/object-broken.cpp
src/object/object-flags.cpp [deleted file]
src/object/object-flags.h [deleted file]
src/object/object-info.cpp
src/object/object-value-calc.cpp
src/object/object-value.cpp
src/object/warning.cpp
src/perception/identification.cpp
src/player-ability/player-charisma.cpp
src/player-ability/player-constitution.cpp
src/player-ability/player-dexterity.cpp
src/player-ability/player-intelligence.cpp
src/player-ability/player-strength.cpp
src/player-ability/player-wisdom.cpp
src/player-attack/player-attack.cpp
src/player-info/base-status-info.cpp
src/player-status/player-basic-statistics.cpp
src/player-status/player-speed.cpp
src/player-status/player-status-base.cpp
src/player/player-damage.cpp
src/player/player-status-flags.cpp
src/player/player-status-resist.cpp
src/player/player-status.cpp
src/player/race-resistances.cpp
src/realm/realm-hex.cpp
src/realm/realm-hissatsu.cpp
src/smith/object-smith.cpp
src/smith/smith-info.cpp
src/specific-object/death-scythe.cpp
src/specific-object/torch.cpp
src/spell-kind/spells-teleport.cpp
src/spell-realm/spells-craft.cpp
src/store/service-checker.cpp
src/system/item-entity.cpp
src/system/item-entity.h
src/view/display-characteristic.cpp
src/view/display-player-stat-info.cpp
src/view/status-first-page.cpp
src/wizard/artifact-analyzer.cpp
src/wizard/artifact-analyzer.h
src/wizard/fixed-artifacts-spoiler.cpp
src/wizard/spoiler-util.cpp
src/wizard/spoiler-util.h
src/wizard/wizard-item-modifier.cpp

index b769d92..257a008 100644 (file)
     <ClCompile Include="..\..\src\mspell\summon-checker.cpp" />\r
     <ClCompile Include="..\..\src\object-enchant\activation-info-table.cpp" />\r
     <ClCompile Include="..\..\src\object-enchant\dragon-breaths-table.cpp" />\r
-    <ClCompile Include="..\..\src\object\object-flags.cpp" />\r
     <ClCompile Include="..\..\src\perception\identification.cpp" />\r
     <ClCompile Include="..\..\src\player-attack\attack-chaos-effect.cpp" />\r
     <ClCompile Include="..\..\src\combat\attack-criticality.cpp" />\r
     <ClInclude Include="..\..\src\object-enchant\dragon-breaths-table.h" />\r
     <ClInclude Include="..\..\src\artifact\random-art-bias-types.h" />\r
     <ClInclude Include="..\..\src\object-enchant\trg-types.h" />\r
-    <ClInclude Include="..\..\src\object\object-flags.h" />\r
     <ClInclude Include="..\..\src\perception\identification.h" />\r
     <ClInclude Include="..\..\src\player-attack\attack-chaos-effect.h" />\r
     <ClInclude Include="..\..\src\combat\attack-criticality.h" />\r
index 9ca4c04..d25e4fa 100644 (file)
     <ClCompile Include="..\..\src\core\visuals-reseter.cpp">\r
       <Filter>core</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\src\object\object-flags.cpp">\r
-      <Filter>object</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\src\object\object-info.cpp">\r
       <Filter>object</Filter>\r
     </ClCompile>\r
     <ClInclude Include="..\..\src\object-enchant\trg-types.h">\r
       <Filter>object-enchant</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\src\object\object-flags.h">\r
-      <Filter>object</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\src\object\object-info.h">\r
       <Filter>object</Filter>\r
     </ClInclude>\r
index ce90327..56a17f3 100644 (file)
@@ -580,7 +580,6 @@ hengband_SOURCES = \
        \
        object/item-tester-hooker.cpp object/item-tester-hooker.h \
        object/object-broken.cpp object/object-broken.h \
-       object/object-flags.cpp object/object-flags.h \
        object/object-index-list.cpp object/object-index-list.h \
        object/object-info.cpp object/object-info.h \
        object/object-kind-hook.cpp object/object-kind-hook.h \
index 363a391..46c43a0 100644 (file)
@@ -9,7 +9,6 @@
 #include "io/files-util.h"
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "system/item-entity.h"
 #include "system/player-type-definition.h"
@@ -164,7 +163,7 @@ std::string get_random_name(const ItemEntity &item, bool armour, int power)
 /*対邪平均ダメージの計算処理*/
 static int calc_arm_avgdamage(PlayerType *player_ptr, ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     int base, forced, vorpal;
     int s_evil = forced = vorpal = 0;
     int dam = base = (o_ptr->dd * o_ptr->ds + o_ptr->dd) / 2;
@@ -196,7 +195,7 @@ static int calc_arm_avgdamage(PlayerType *player_ptr, ItemEntity *o_ptr)
 
 bool has_extreme_damage_rate(PlayerType *player_ptr, ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     if (flags.has(TR_VAMPIRIC)) {
         if (flags.has(TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(player_ptr, o_ptr) > 52)) {
             return true;
index 63f8f3a..f02f812 100644 (file)
@@ -24,7 +24,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-hook/hook-armor.h"
 #include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
 #include "object/object-kind-hook.h"
 #include "object/object-value-calc.h"
 #include "object/tval-types.h"
@@ -45,9 +44,7 @@
 static bool weakening_artifact(ItemEntity *o_ptr)
 {
     const auto &baseitem = o_ptr->get_baseitem();
-    auto flags = object_flags(o_ptr);
-
-    if (flags.has(TR_KILL_EVIL)) {
+    if (o_ptr->get_flags().has(TR_KILL_EVIL)) {
         o_ptr->art_flags.reset(TR_KILL_EVIL);
         o_ptr->art_flags.set(TR_SLAY_EVIL);
         return true;
index 544bbdf..e1f5ae3 100644 (file)
@@ -26,7 +26,6 @@
 #include "object-hook/hook-weapon.h"
 #include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "object/object-mark-types.h"
 #include "perception/object-perception.h"
@@ -76,7 +75,7 @@ static void do_curse_on_equip(OBJECT_IDX slot, ItemEntity *o_ptr, PlayerType *pl
         return;
     }
 
-    auto should_curse = object_flags(o_ptr).has(TR_PERSISTENT_CURSE) || o_ptr->curse_flags.has(CurseTraitType::PERSISTENT_CURSE);
+    auto should_curse = o_ptr->get_flags().has(TR_PERSISTENT_CURSE) || o_ptr->curse_flags.has(CurseTraitType::PERSISTENT_CURSE);
     should_curse &= o_ptr->curse_flags.has_not(CurseTraitType::HEAVY_CURSE);
     if (!should_curse) {
         return;
index 36d79a0..cf4ae2b 100644 (file)
@@ -7,7 +7,6 @@
 #include "object-hook/hook-expendable.h"
 #include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-info/samurai-data-type.h"
 #include "player-status/player-energy.h"
@@ -37,11 +36,11 @@ static void do_cmd_refill_lamp(PlayerType *player_ptr)
         return;
     }
 
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
 
     PlayerEnergy(player_ptr).set_player_turn_energy(50);
     j_ptr = &player_ptr->inventory_list[INVEN_LITE];
-    auto flags2 = object_flags(j_ptr);
+    const auto flags2 = j_ptr->get_flags();
     j_ptr->fuel += o_ptr->fuel;
     msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
     if (flags.has(TR_DARK_SOURCE) && (j_ptr->fuel > 0)) {
@@ -75,11 +74,11 @@ static void do_cmd_refill_torch(PlayerType *player_ptr)
         return;
     }
 
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
 
     PlayerEnergy(player_ptr).set_player_turn_energy(50);
     j_ptr = &player_ptr->inventory_list[INVEN_LITE];
-    auto flags2 = object_flags(j_ptr);
+    const auto flags2 = j_ptr->get_flags();
     j_ptr->fuel += o_ptr->fuel + 5;
     msg_print(_("松明を結合した。", "You combine the torches."));
     if (flags.has(TR_DARK_SOURCE) && (j_ptr->fuel > 0)) {
index e9d521d..3dfc77a 100644 (file)
@@ -43,7 +43,6 @@
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
 #include "object/object-broken.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "object/object-mark-types.h"
 #include "player-base/player-class.h"
@@ -84,11 +83,9 @@ AttributeFlags shot_attribute(PlayerType *player_ptr, ItemEntity *bow_ptr, ItemE
     AttributeFlags attribute_flags{};
     attribute_flags.set(AttributeType::PLAYER_SHOOT);
 
-    TrFlags flags{};
-    auto arrow_flags = object_flags(arrow_ptr);
-    auto bow_flags = object_flags(bow_ptr);
-
-    flags = bow_flags | arrow_flags;
+    const auto arrow_flags = arrow_ptr->get_flags();
+    const auto bow_flags = bow_ptr->get_flags();
+    const auto flags = bow_flags | arrow_flags;
 
     static const struct snipe_convert_table_t {
         SPELL_IDX snipe_type;
@@ -158,11 +155,9 @@ static MULTIPLY calc_shot_damage_with_slay(
 
     MonsterRaceInfo *race_ptr = &monraces_info[monster_ptr->r_idx];
 
-    TrFlags flags{};
-    auto arrow_flags = object_flags(arrow_ptr);
-    auto bow_flags = object_flags(bow_ptr);
-
-    flags = bow_flags | arrow_flags;
+    const auto arrow_flags = arrow_ptr->get_flags();
+    const auto bow_flags = bow_ptr->get_flags();
+    const auto flags = bow_flags | arrow_flags;
 
     /* Some "weapons" and "ammo" do extra damage */
     switch (arrow_ptr->bi_key.tval()) {
index 5fb9587..4fd0e11 100644 (file)
@@ -10,7 +10,6 @@
 #include "monster-race/race-resistance-mask.h"
 #include "monster/monster-info.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "player-base/player-class.h"
 #include "player/attack-defense-types.h"
@@ -152,7 +151,7 @@ MULTIPLY mult_brand(PlayerType *player_ptr, MULTIPLY mult, const TrFlags &flags,
  */
 int calc_attack_damage_with_slay(PlayerType *player_ptr, ItemEntity *o_ptr, int tdam, MonsterEntity *m_ptr, combat_options mode, bool thrown)
 {
-    auto flags = object_flags(o_ptr);
+    auto flags = o_ptr->get_flags();
     torch_flags(o_ptr, flags); /* torches has secret flags */
 
     if (!thrown) {
@@ -244,7 +243,7 @@ AttributeFlags melee_attribute(PlayerType *player_ptr, ItemEntity *o_ptr, combat
         }
     }
 
-    auto flags = object_flags(o_ptr);
+    auto flags = o_ptr->get_flags();
 
     if (player_ptr->special_attack & (ATTACK_ACID)) {
         flags.set(TR_BRAND_ACID);
index 67e6bb3..eae5bd9 100644 (file)
@@ -11,7 +11,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-hook/hook-expendable.h"
 #include "object/object-broken.h"
-#include "object/object-flags.h"
 #include "object/object-mark-types.h"
 #include "perception/object-perception.h"
 #include "spell-kind/spells-perception.h"
@@ -64,7 +63,7 @@ bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y
 #else
         bool plural = (o_ptr->number > 1);
 #endif
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
         bool is_fixed_or_random_artifact = o_ptr->is_fixed_or_random_artifact();
         switch (typ) {
         case AttributeType::ACID: {
index b54915d..c9f7a90 100644 (file)
@@ -20,7 +20,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trg-types.h"
 #include "object-hook/hook-quest.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "perception/object-perception.h"
 #include "player-base/player-class.h"
@@ -112,7 +111,7 @@ static bool should_show_ac_bonus(const ItemEntity &item)
 
 static bool should_show_slaying_bonus(const ItemEntity &item)
 {
-    if (object_flags(&item).has(TR_SHOW_MODS)) {
+    if (item.get_flags().has(TR_SHOW_MODS)) {
         return true;
     }
 
@@ -154,7 +153,7 @@ static std::string describe_weapon_dice(PlayerType *player_ptr, const ItemEntity
 static std::string describe_bow_power(PlayerType *player_ptr, const ItemEntity &item, const describe_option_type &opt)
 {
     auto power = item.get_arrow_magnification();
-    const auto tr_flags = object_flags(&item);
+    const auto tr_flags = item.get_flags();
     if (tr_flags.has(TR_XTRA_MIGHT)) {
         power++;
     }
@@ -355,7 +354,7 @@ static std::string describe_charges_rod(const ItemEntity &item)
 
 static std::string describe_pval_type(const ItemEntity &item)
 {
-    const auto tr_flags = object_flags(&item);
+    const auto tr_flags = item.get_flags();
     if (tr_flags.has(TR_HIDE_TYPE)) {
         return "";
     }
@@ -385,7 +384,7 @@ static std::string describe_pval_type(const ItemEntity &item)
 
 static std::string describe_pval(const ItemEntity &item)
 {
-    const auto tr_flags = object_flags(&item);
+    const auto tr_flags = item.get_flags();
     if (tr_flags.has_none_of(TR_PVAL_FLAG_MASK)) {
         return "";
     }
index ddb70f7..5f94b61 100644 (file)
@@ -2,7 +2,6 @@
 #include "flavor/flag-inscriptions-table.h"
 #include "object-enchant/tr-flags.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "sv-definition/sv-food-types.h"
 #include "system/artifact-type-definition.h"
@@ -68,7 +67,7 @@ static bool has_flag_of(const std::vector<flag_insc_table> &fi_vec, const TrFlag
  */
 std::string get_ability_abbreviation(const ItemEntity &item, bool is_kanji, bool all)
 {
-    auto flags = object_flags(&item);
+    auto flags = item.get_flags();
     if (!all) {
         const auto &baseitem = item.get_baseitem();
         flags.reset(baseitem.flags);
index 2bde316..3c3db52 100644 (file)
@@ -9,7 +9,6 @@
 #include "object-enchant/object-ego.h"
 #include "object-enchant/special-object-flags.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "perception/object-perception.h"
 #include "system/artifact-type-definition.h"
 #include "system/item-entity.h"
@@ -27,7 +26,7 @@
 
 static std::string get_fullname_if_set(const ItemEntity &item, const describe_option_type &opt)
 {
-    if (!opt.aware || object_flags(&item).has_not(TR_FULL_NAME)) {
+    if (!opt.aware || item.get_flags().has_not(TR_FULL_NAME)) {
         return "";
     }
 
@@ -107,7 +106,7 @@ static std::string describe_unique_name_before_body_ja(const ItemEntity &item, c
         }
     }
 
-    if (item.is_fixed_artifact() && object_flags(&item).has_not(TR_FULL_NAME)) {
+    if (item.is_fixed_artifact() && item.get_flags().has_not(TR_FULL_NAME)) {
         const auto &artifact = item.get_fixed_artifact();
         /* '『' から始まらない伝説のアイテムの名前は最初に付加する */
         if (artifact.name.find("『", 0, 2) != 0) {
@@ -280,7 +279,7 @@ static std::string describe_item_count_or_definite_article_en(const ItemEntity &
 
 static std::string describe_unique_name_after_body_en(const ItemEntity &item, const describe_option_type &opt)
 {
-    if (!opt.known || object_flags(&item).has(TR_FULL_NAME) || any_bits(opt.mode, OD_BASE_NAME)) {
+    if (!opt.known || item.get_flags().has(TR_FULL_NAME) || any_bits(opt.mode, OD_BASE_NAME)) {
         return "";
     }
 
index 7812d06..e0a91a9 100644 (file)
@@ -29,7 +29,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trg-types.h"
 #include "object-hook/hook-quest.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "perception/object-perception.h"
 #include "player-info/class-info.h"
index 27eb085..b09cfe4 100644 (file)
@@ -16,7 +16,6 @@
 #include "object-enchant/object-ego.h"
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "pet/pet-util.h"
 #include "player-base/player-class.h"
@@ -149,7 +148,7 @@ void process_player_hp_mp(PlayerType *player_ptr)
 
         ItemEntity *o_ptr;
         o_ptr = &player_ptr->inventory_list[INVEN_LITE];
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
 
         if ((player_ptr->inventory_list[INVEN_LITE].bi_key.tval() != ItemKindType::NONE) && flags.has_not(TR_DARK_SOURCE) && !has_resist_lite(player_ptr)) {
             const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
index 7ae37ec..08e9c01 100644 (file)
@@ -13,7 +13,6 @@
 #include "object-enchant/special-object-flags.h"
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
 #include "perception/object-perception.h"
 #include "player-base/player-race.h"
 #include "player-info/race-types.h"
@@ -90,7 +89,7 @@ static void choise_cursed_item(CurseTraitType flag, ItemEntity *o_ptr, int *choi
     }
 
     tr_type cf = TR_STR;
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     switch (flag) {
     case CurseTraitType::ADD_L_CURSE:
         cf = TR_ADD_L_CURSE;
@@ -201,7 +200,7 @@ static void curse_teleport(PlayerType *player_ptr)
             continue;
         }
 
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
 
         if (flags.has_not(TR_TELEPORT)) {
             continue;
index 4111d02..5ca4cf7 100644 (file)
@@ -21,7 +21,7 @@
  * @param art_ptr 記述内容を収めた構造体参照ポインタ
  * Fill in an object description structure for a given object
  */
-static void spoiler_print_randart(ItemEntity *o_ptr, obj_desc_list *art_ptr, std::ofstream &ofs)
+static void spoiler_print_randart(ItemEntity *o_ptr, const ArtifactsDumpInfo *art_ptr, std::ofstream &ofs)
 {
     const auto finalizer = util::make_finalizer([art_ptr, &ofs]() {
         ofs << spoiler_indent << art_ptr->misc_desc << "\n\n";
@@ -58,13 +58,12 @@ static void spoiler_print_randart(ItemEntity *o_ptr, obj_desc_list *art_ptr, std
  */
 static void spoil_random_artifact_aux(PlayerType *player_ptr, ItemEntity *o_ptr, ItemKindType tval, std::ofstream &ofs)
 {
-    obj_desc_list artifact;
     if (!o_ptr->is_known() || !o_ptr->is_random_artifact() || (o_ptr->bi_key.tval() != tval)) {
         return;
     }
 
-    random_artifact_analyze(player_ptr, o_ptr, &artifact);
-    spoiler_print_randart(o_ptr, &artifact, ofs);
+    const auto artifacts_list = random_artifact_analyze(player_ptr, o_ptr);
+    spoiler_print_randart(o_ptr, &artifacts_list, ofs);
 }
 
 /*!
index 943fee3..a5689cd 100644 (file)
@@ -14,7 +14,6 @@
 #include "object-enchant/special-object-flags.h"
 #include "object-enchant/tr-types.h"
 #include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "perception/object-perception.h"
 #include "store/store-util.h"
@@ -110,7 +109,7 @@ static bool check_item_knowledge(ItemEntity *o_ptr, ItemKindType tval)
  */
 static void display_identified_resistances_flag(ItemEntity *o_ptr, FILE *fff)
 {
-    auto flags = object_flags_known(o_ptr);
+    auto flags = o_ptr->get_flags_known();
 
     print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID, flags, fff);
     print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC, flags, fff);
index 9e341c9..df297d0 100644 (file)
@@ -8,7 +8,6 @@
 #include "load/savedata-old-flag-types.h"
 #include "object-enchant/object-ego.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "sv-definition/sv-lite-types.h"
 #include "system/angband.h"
index 35e68d7..ed87aa5 100644 (file)
@@ -15,7 +15,6 @@
 #include "object-hook/hook-weapon.h"
 #include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "object/object-kind-hook.h"
 #include "object/object-value.h"
 #include "racial/racial-android.h"
@@ -40,8 +39,8 @@
  */
 static void give_one_ability_of_object(ItemEntity *to_ptr, ItemEntity *from_ptr)
 {
-    auto to_flags = object_flags(to_ptr);
-    auto from_flags = object_flags(from_ptr);
+    const auto to_flags = to_ptr->get_flags();
+    const auto from_flags = from_ptr->get_flags();
 
     std::vector<tr_type> candidates;
     for (int i = 0; i < TR_FLAG_MAX; i++) {
index 3c78bee..ed30c31 100644 (file)
@@ -13,7 +13,6 @@
 #include "object-hook/hook-weapon.h"
 #include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "realm/realm-hex-numbers.h"
 #include "spell-realm/spells-hex.h"
@@ -133,7 +132,7 @@ static void compare_weapon_aux(PlayerType *player_ptr, ItemEntity *o_ptr, int co
     int vorpal_div = 1;
     int dmg_bonus = o_ptr->to_d + player_ptr->to_d[0];
 
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     if (o_ptr->bi_key == BaseitemKey(ItemKindType::SWORD, SV_POISON_NEEDLE)) {
         dokubari = true;
     }
index 7c4d210..ddb28dc 100644 (file)
@@ -10,7 +10,6 @@
 #include "object-hook/hook-weapon.h"
 #include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "racial/racial-android.h"
 #include "system/item-entity.h"
 #include "system/player-type-definition.h"
@@ -36,7 +35,7 @@ bool bless_weapon(PlayerType *player_ptr)
     }
 
     const auto item_name = describe_flavor(player_ptr, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
-    auto item_flags = object_flags(o_ptr);
+    const auto item_flags = o_ptr->get_flags();
     auto &rfu = RedrawingFlagsUpdater::get_instance();
     if (o_ptr->is_cursed()) {
         auto can_disturb_blessing = o_ptr->curse_flags.has(CurseTraitType::HEAVY_CURSE) && (randint1(100) < 33);
index e39f506..c436ebd 100644 (file)
@@ -21,7 +21,6 @@
 #include "monster/monster-processor-util.h"
 #include "monster/smart-learn-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/object-mark-types.h"
 #include "system/floor-type-definition.h"
 #include "system/grid-type-definition.h"
@@ -200,7 +199,7 @@ void update_object_by_monster_movement(PlayerType *player_ptr, turn_flags *turn_
             }
         }
 
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
         const auto item_name = describe_flavor(player_ptr, o_ptr, 0);
         const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_HIDDEN);
         update_object_flags(flags, flg_monster_kind, flgr);
index b7e6ebe..47fb99f 100644 (file)
@@ -1,7 +1,6 @@
 #include "object-activation/activation-breath.h"
 #include "effect/attribute-types.h"
 #include "object-enchant/dragon-breaths-table.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "player/player-status.h"
 #include "spell-kind/spells-launcher.h"
@@ -29,7 +28,7 @@ bool activate_dragon_breath(PlayerType *player_ptr, ItemEntity *o_ptr)
         return false;
     }
 
-    auto resistance_flags = object_flags(o_ptr);
+    const auto resistance_flags = o_ptr->get_flags();
 
     AttributeType type[20];
     int n = 0;
index c687c9d..8300e91 100644 (file)
@@ -7,7 +7,6 @@
 #include "object-enchant/trc-types.h"
 #include "object-hook/hook-armor.h"
 #include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
 #include "system/item-entity.h"
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
@@ -75,7 +74,7 @@ void curse_equipment(PlayerType *player_ptr, PERCENTAGE chance, PERCENTAGE heavy
         return;
     }
 
-    auto oflags = object_flags(o_ptr);
+    const auto oflags = o_ptr->get_flags();
     const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
     /* Extra, biased saving throw for blessed items */
index f12c3e3..8c14020 100644 (file)
@@ -1,7 +1,6 @@
 #include "object-hook/hook-magic.h"
 #include "inventory/inventory-slot-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "perception/object-perception.h"
 #include "player-base/player-class.h"
 #include "player-info/class-info.h"
@@ -41,11 +40,8 @@ bool item_tester_hook_use(PlayerType *player_ptr, const ItemEntity *o_ptr)
         }
 
         for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
-            if (&player_ptr->inventory_list[i] == o_ptr) {
-                auto flags = object_flags(o_ptr);
-                if (flags.has(TR_ACTIVATE)) {
-                    return true;
-                }
+            if ((&player_ptr->inventory_list[i] == o_ptr) && o_ptr->get_flags().has(TR_ACTIVATE)) {
+                return true;
             }
         }
 
index f7a976c..980b22d 100644 (file)
@@ -1,7 +1,6 @@
 #include "object-hook/hook-weapon.h"
 #include "object-enchant/tr-types.h"
 #include "object-hook/hook-armor.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "player/player-skill.h"
 #include "sv-definition/sv-weapon-types.h"
@@ -25,7 +24,7 @@ bool object_is_favorite(PlayerType *player_ptr, const ItemEntity *o_ptr)
     const auto sval = o_ptr->bi_key.sval().value();
     switch (player_ptr->pclass) {
     case PlayerClassType::PRIEST: {
-        const auto flags = object_flags_known(o_ptr);
+        const auto flags = o_ptr->get_flags_known();
         return flags.has(TR_BLESSED) || (tval == ItemKindType::HAFTED);
     }
     case PlayerClassType::MONK:
@@ -35,7 +34,7 @@ bool object_is_favorite(PlayerType *player_ptr, const ItemEntity *o_ptr)
     case PlayerClassType::BEASTMASTER:
     case PlayerClassType::CAVALRY: {
         /* Is it known to be suitable to using while riding? */
-        auto flags = object_flags_known(o_ptr);
+        auto flags = o_ptr->get_flags_known();
         return flags.has(TR_RIDING);
     }
     case PlayerClassType::SORCERER:
index 3886bcd..e1c6a21 100644 (file)
@@ -44,7 +44,6 @@
 #include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
 #include "object/object-broken.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "object/object-stack.h"
 #include "player-base/player-class.h"
@@ -106,7 +105,7 @@ bool ObjectThrowEntity::check_can_throw()
 void ObjectThrowEntity::calc_throw_range()
 {
     this->q_ptr->copy_from(this->o_ptr);
-    this->obj_flags = object_flags(this->q_ptr);
+    this->obj_flags = this->q_ptr->get_flags();
     torch_flags(this->q_ptr, this->obj_flags);
     distribute_charges(this->o_ptr, this->q_ptr, 1);
     this->q_ptr->number = 1;
index 1932515..5acedfa 100644 (file)
@@ -9,7 +9,6 @@
 #include "effect/effect-processor.h"
 #include "mind/snipe-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "sv-definition/sv-potion-types.h"
 #include "system/baseitem-info.h"
@@ -172,8 +171,7 @@ bool ObjectBreaker::can_destroy(ItemEntity *o_ptr) const
         return false;
     }
 
-    auto flags = object_flags(o_ptr);
-    return flags.has_not(this->ignore_flg);
+    return o_ptr->get_flags().has_not(this->ignore_flg);
 }
 
 /*!
diff --git a/src/object/object-flags.cpp b/src/object/object-flags.cpp
deleted file mode 100644 (file)
index d29eef9..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-#include "object/object-flags.h"
-#include "mind/mind-weaponsmith.h"
-#include "object-enchant/object-ego.h"
-#include "object-enchant/tr-types.h"
-#include "object/tval-types.h"
-#include "perception/object-perception.h"
-#include "smith/object-smith.h"
-#include "system/artifact-type-definition.h"
-#include "system/baseitem-info.h"
-#include "system/item-entity.h"
-#include "system/player-type-definition.h"
-#include "util/bit-flags-calculator.h"
-
-/*!
- * @brief エゴ光源のフラグを修正する
- *
- * 寿命のある光源で寿命が0ターンの時、光源エゴアイテムに起因するフラグは
- * 灼熱エゴの火炎耐性を除き付与されないようにする。
- *
- * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
- * @param flags フラグ情報を受け取る配列
- */
-static void modify_ego_lite_flags(const ItemEntity *o_ptr, TrFlags &flags)
-{
-    if (o_ptr->bi_key.tval() != ItemKindType::LITE) {
-        return;
-    }
-
-    if (!o_ptr->is_lite_requiring_fuel() || o_ptr->fuel != 0) {
-        return;
-    }
-
-    switch (o_ptr->ego_idx) {
-    case EgoType::LITE_AURA_FIRE:
-        flags.reset(TR_SH_FIRE);
-        return;
-    case EgoType::LITE_INFRA:
-        flags.reset(TR_INFRA);
-        return;
-    case EgoType::LITE_EYE:
-        flags.reset({ TR_RES_BLIND, TR_SEE_INVIS });
-        return;
-    default:
-        return;
-    }
-}
-
-/*!
- * @brief オブジェクトのフラグ類を配列に与える
- * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
- * @param flags フラグ情報を受け取る配列
- */
-TrFlags object_flags(const ItemEntity *o_ptr)
-{
-    const auto &baseitem = o_ptr->get_baseitem();
-    auto flags = baseitem.flags;
-
-    if (o_ptr->is_fixed_artifact()) {
-        flags = o_ptr->get_fixed_artifact().flags;
-    }
-
-    if (o_ptr->is_ego()) {
-        const auto &ego = o_ptr->get_ego();
-        flags.set(ego.flags);
-        modify_ego_lite_flags(o_ptr, flags);
-    }
-
-    flags.set(o_ptr->art_flags);
-    if (auto effect = Smith::object_effect(o_ptr); effect.has_value()) {
-        auto tr_flags = Smith::get_effect_tr_flags(effect.value());
-        flags.set(tr_flags);
-    }
-
-    if (Smith::object_activation(o_ptr).has_value()) {
-        flags.set(TR_ACTIVATE);
-    }
-
-    return flags;
-}
-
-/*!
- * @brief オブジェクトの明示されているフラグ類を取得する
- * Obtain the "flags" for an item which are known to the player
- * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
- * @param flags フラグ情報を受け取る配列
- */
-TrFlags object_flags_known(const ItemEntity *o_ptr)
-{
-    TrFlags flags{};
-    if (!o_ptr->is_aware()) {
-        return flags;
-    }
-
-    const auto &baseitem = o_ptr->get_baseitem();
-    flags = baseitem.flags;
-    if (!o_ptr->is_known()) {
-        return flags;
-    }
-
-    if (o_ptr->is_ego()) {
-        const auto &ego = o_ptr->get_ego();
-        flags.set(ego.flags);
-        modify_ego_lite_flags(o_ptr, flags);
-    }
-
-    if (o_ptr->is_fully_known()) {
-        if (o_ptr->is_fixed_artifact()) {
-            flags = o_ptr->get_fixed_artifact().flags;
-        }
-
-        flags.set(o_ptr->art_flags);
-    }
-
-    if (auto effect = Smith::object_effect(o_ptr); effect.has_value()) {
-        auto tr_flags = Smith::get_effect_tr_flags(effect.value());
-        flags.set(tr_flags);
-    }
-
-    if (Smith::object_activation(o_ptr).has_value()) {
-        flags.set(TR_ACTIVATE);
-    }
-
-    return flags;
-}
diff --git a/src/object/object-flags.h b/src/object/object-flags.h
deleted file mode 100644 (file)
index 0ed2d0a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#pragma once
-
-#include "system/angband.h"
-#include "system/system-variables.h"
-
-#include "object-enchant/tr-flags.h"
-
-class ItemEntity;
-TrFlags object_flags(const ItemEntity *o_ptr);
-TrFlags object_flags_known(const ItemEntity *o_ptr);
index 2ec6ef0..8f4ade8 100644 (file)
@@ -19,7 +19,6 @@
 #include "object-enchant/activation-info-table.h"
 #include "object-enchant/dragon-breaths-table.h"
 #include "object-enchant/object-ego.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player/player-realm.h"
 #include "realm/realm-names-table.h"
@@ -45,7 +44,7 @@ static std::string item_activation_dragon_breath(const ItemEntity *o_ptr)
     std::string desc = _("", "breathe ");
     int n = 0;
 
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
 
     for (int i = 0; dragonbreath_info[i].flag != 0; i++) {
         if (flags.has(dragonbreath_info[i].flag)) {
@@ -187,7 +186,7 @@ static concptr item_activation_aux(const ItemEntity *o_ptr)
  */
 std::string activation_explanation(const ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     if (flags.has_not(TR_ACTIVATE)) {
         return _("なし", "nothing");
     }
index c415194..5d67cb3 100644 (file)
@@ -4,7 +4,6 @@
 #include "object-enchant/object-ego.h"
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
 #include "system/artifact-type-definition.h"
 #include "system/baseitem-info.h"
 #include "system/item-entity.h"
@@ -21,7 +20,7 @@
 PRICE flag_cost(const ItemEntity *o_ptr, int plusses)
 {
     PRICE total = 0;
-    auto flags = object_flags(o_ptr);
+    auto flags = o_ptr->get_flags();
     const auto &baseitem = o_ptr->get_baseitem();
     flags.reset(baseitem.flags);
 
index e187d25..7faa7ec 100644 (file)
@@ -1,6 +1,5 @@
 #include "object/object-value.h"
 #include "monster-race/monster-race.h"
-#include "object/object-flags.h"
 #include "object/object-value-calc.h"
 #include "object/tval-types.h"
 #include "system/artifact-type-definition.h"
@@ -44,7 +43,7 @@ PRICE object_value_real(const ItemEntity *o_ptr)
     }
 
     PRICE value = baseitem.cost;
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     if (o_ptr->is_fixed_artifact()) {
         const auto &artifact = o_ptr->get_fixed_artifact();
         if (!artifact.cost) {
index 71d7eeb..dddebc5 100644 (file)
@@ -21,7 +21,6 @@
 #include "mspell/mspell-damage-calculator.h"
 #include "mutation/mutation-flag-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-race.h"
 #include "player/player-status-flags.h"
 #include "player/player-status-resist.h"
@@ -57,10 +56,8 @@ ItemEntity *choose_warning_item(PlayerType *player_ptr)
     /* Search Inventory */
     std::vector<int> candidates;
     for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
-        auto *o_ptr = &player_ptr->inventory_list[i];
-
-        auto flags = object_flags(o_ptr);
-        if (flags.has(TR_WARNING)) {
+        const auto *o_ptr = &player_ptr->inventory_list[i];
+        if (o_ptr->get_flags().has(TR_WARNING)) {
             candidates.push_back(i);
         }
     }
index 5f40f9a..30274a3 100644 (file)
@@ -11,7 +11,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
 #include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "sv-definition/sv-amulet-types.h"
 #include "sv-definition/sv-other-types.h"
@@ -41,7 +40,7 @@ bool screen_object(PlayerType *player_ptr, ItemEntity *o_ptr, BIT_FLAGS mode)
 {
     std::array<std::string, 128> info{};
     int trivial_info = 0;
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
 
     const auto item_text = o_ptr->is_fixed_artifact() ? o_ptr->get_fixed_artifact().text.data() : o_ptr->get_baseitem().text.data();
     const auto item_text_lines = shape_buffer(item_text, 77 - 15);
index c7bbe64..50336d9 100644 (file)
@@ -1,6 +1,5 @@
 #include "player-ability/player-charisma.h"
 #include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-info/class-info.h"
 #include "player-info/mimic-info-table.h"
index ae1628c..de3d0f7 100644 (file)
@@ -1,6 +1,5 @@
 #include "player-ability/player-constitution.h"
 #include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-base/player-race.h"
 #include "player-info/class-info.h"
index 74f6edc..70a49ad 100644 (file)
@@ -1,6 +1,5 @@
 #include "player-ability/player-dexterity.h"
 #include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-base/player-race.h"
 #include "player-info/class-info.h"
index 34074cb..18a9106 100644 (file)
@@ -1,6 +1,5 @@
 #include "player-ability/player-intelligence.h"
 #include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-info/class-info.h"
 #include "player-info/mimic-info-table.h"
index 18ced57..b9b16a7 100644 (file)
@@ -1,6 +1,5 @@
 #include "player-ability/player-strength.h"
 #include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-base/player-race.h"
 #include "player-info/monk-data-type.h"
index 3220e4e..f638236 100644 (file)
@@ -1,6 +1,5 @@
 #include "player-ability/player-wisdom.h"
 #include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-info/class-info.h"
 #include "player-info/mimic-info-table.h"
index e349aeb..13774d7 100644 (file)
@@ -32,7 +32,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/vorpal-weapon.h"
 #include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "player-attack/attack-chaos-effect.h"
 #include "player-attack/blood-sucking-processor.h"
@@ -487,7 +486,7 @@ static void apply_actual_attack(
     sound(SOUND_HIT);
     print_surprise_attack(pa_ptr);
 
-    pa_ptr->flags = object_flags(o_ptr);
+    pa_ptr->flags = o_ptr->get_flags();
     pa_ptr->chaos_effect = select_chaotic_effect(player_ptr, pa_ptr);
     pa_ptr->magical_effect = select_magical_brand_effect(player_ptr, pa_ptr);
     decide_blood_sucking(player_ptr, pa_ptr);
index 7c42877..99f5370 100644 (file)
@@ -1,7 +1,6 @@
 #include "player-info/base-status-info.h"
 #include "inventory/inventory-slot-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-info/self-info-util.h"
 #include "player/player-status-flags.h"
 #include "system/player-type-definition.h"
@@ -15,7 +14,7 @@ void set_equipment_influence(PlayerType *player_ptr, self_info_type *self_ptr)
             continue;
         }
 
-        auto tflags = object_flags(o_ptr);
+        const auto tflags = o_ptr->get_flags();
         self_ptr->flags.set(tflags);
     }
 
index a01d17c..081008a 100644 (file)
@@ -1,7 +1,6 @@
 #include "player-status/player-basic-statistics.h"
 #include "core/window-redrawer.h"
 #include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-race.h"
 #include "player-info/class-info.h"
 #include "player-info/mimic-info-table.h"
index 674ea1b..4999729 100644 (file)
@@ -7,7 +7,6 @@
 #include "monster/monster-status.h"
 #include "mutation/mutation-flag-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-base/player-race.h"
 #include "player-info/equipment-info.h"
index bdb1089..a110159 100644 (file)
@@ -1,6 +1,5 @@
 #include "player-status/player-status-base.h"
 #include "inventory/inventory-slot-types.h"
-#include "object/object-flags.h"
 #include "player/player-status.h"
 #include "system/item-entity.h"
 #include "system/player-type-definition.h"
@@ -217,7 +216,7 @@ BIT_FLAGS PlayerStatusBase::equipments_flags(tr_type check_flag)
             continue;
         }
 
-        auto o_flags = object_flags(o_ptr);
+        const auto o_flags = o_ptr->get_flags();
         if (o_flags.has(check_flag)) {
             set_bits(flags, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
         }
@@ -240,7 +239,7 @@ BIT_FLAGS PlayerStatusBase::equipments_bad_flags(tr_type check_flag)
             continue;
         }
 
-        auto o_flags = object_flags(o_ptr);
+        const auto o_flags = o_ptr->get_flags();
         if (o_flags.has(check_flag)) {
             if (o_ptr->pval < 0) {
                 set_bits(flags, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
@@ -260,8 +259,8 @@ int16_t PlayerStatusBase::equipments_bonus()
     this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
     int16_t bonus = 0;
     for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
-        auto *o_ptr = &player_ptr->inventory_list[i];
-        auto o_flags = object_flags(o_ptr);
+        const auto *o_ptr = &player_ptr->inventory_list[i];
+        const auto o_flags = o_ptr->get_flags();
         if (!o_ptr->is_valid()) {
             continue;
         }
index 92822f9..d195b05 100644 (file)
@@ -39,7 +39,6 @@
 #include "object-hook/hook-armor.h"
 #include "object/item-tester-hooker.h"
 #include "object/object-broken.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-base/player-race.h"
 #include "player-info/class-info.h"
@@ -107,7 +106,7 @@ static bool acid_minus_ac(PlayerType *player_ptr)
     }
 
     const auto item_name = describe_flavor(player_ptr, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
-    auto item_flags = object_flags(o_ptr);
+    const auto item_flags = o_ptr->get_flags();
     if (o_ptr->ac + o_ptr->to_a <= 0) {
         msg_format(_("%sは既にボロボロだ!", "Your %s is already fully corroded!"), item_name.data());
         return false;
index dc793d1..b3d6ef9 100644 (file)
@@ -10,7 +10,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
 #include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
 #include "player-ability/player-charisma.h"
 #include "player-ability/player-constitution.h"
 #include "player-ability/player-dexterity.h"
@@ -128,7 +127,7 @@ BIT_FLAGS check_equipment_flags(PlayerType *player_ptr, tr_type tr_flag)
             continue;
         }
 
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
 
         if (flags.has(tr_flag)) {
             set_bits(result, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
@@ -802,7 +801,7 @@ BIT_FLAGS has_warning(PlayerType *player_ptr)
             continue;
         }
 
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
 
         if (flags.has(TR_WARNING)) {
             if (!o_ptr->is_inscribed() || !angband_strchr(o_ptr->inscription->data(), '$')) {
@@ -1071,7 +1070,7 @@ void update_curses(PlayerType *player_ptr)
         if (!o_ptr->is_valid()) {
             continue;
         }
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
         if (flags.has(TR_AGGRAVATE)) {
             player_ptr->cursed.set(CurseTraitType::AGGRAVATE);
         }
@@ -1182,7 +1181,7 @@ void update_extra_blows(PlayerType *player_ptr)
             continue;
         }
 
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
         if (flags.has(TR_BLOWS)) {
             if ((i == INVEN_MAIN_HAND || i == INVEN_MAIN_RING) && !two_handed) {
                 player_ptr->extra_blows[0] += o_ptr->pval;
@@ -1485,7 +1484,7 @@ BIT_FLAGS has_vuln_curse(PlayerType *player_ptr)
             continue;
         }
 
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
 
         if (flags.has(TR_VUL_CURSE) || o_ptr->curse_flags.has(CurseTraitType::VUL_CURSE)) {
             set_bits(result, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
@@ -1510,7 +1509,7 @@ BIT_FLAGS has_heavy_vuln_curse(PlayerType *player_ptr)
             continue;
         }
 
-        auto flags = object_flags(o_ptr);
+        const auto flags = o_ptr->get_flags();
 
         if ((flags.has(TR_VUL_CURSE) || o_ptr->curse_flags.has(CurseTraitType::VUL_CURSE)) && o_ptr->curse_flags.has(CurseTraitType::HEAVY_CURSE)) {
             set_bits(result, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
@@ -1726,8 +1725,8 @@ bool has_disable_two_handed_bonus(PlayerType *player_ptr, int i)
  */
 bool is_wielding_icky_weapon(PlayerType *player_ptr, int i)
 {
-    auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
-    auto flags = object_flags(o_ptr);
+    const auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
+    const auto flags = o_ptr->get_flags();
 
     const auto tval = o_ptr->bi_key.tval();
     const auto has_no_weapon = (tval == ItemKindType::NONE) || (tval == ItemKindType::SHIELD);
@@ -1754,8 +1753,8 @@ bool is_wielding_icky_weapon(PlayerType *player_ptr, int i)
  */
 bool is_wielding_icky_riding_weapon(PlayerType *player_ptr, int i)
 {
-    auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
-    auto flags = object_flags(o_ptr);
+    const auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
+    const auto flags = o_ptr->get_flags();
     const auto tval = o_ptr->bi_key.tval();
     const auto has_no_weapon = (tval == ItemKindType::NONE) || (tval == ItemKindType::SHIELD);
     const auto is_suitable = o_ptr->is_lance() || flags.has(TR_RIDING);
index 6a2a3e2..30d5099 100644 (file)
@@ -10,7 +10,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
 #include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
 #include "player-base/player-race.h"
 #include "player-info/class-info.h"
 #include "player-info/race-info.h"
index 7cad3d1..08b1646 100644 (file)
@@ -46,7 +46,6 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
 #include "object-hook/hook-armor.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "object/object-mark-types.h"
 #include "perception/object-perception.h"
@@ -834,8 +833,8 @@ static void update_max_mana(PlayerType *player_ptr)
 
     if (any_bits(mp_ptr->spell_xtra, extra_magic_glove_reduce_mana)) {
         player_ptr->cumber_glove = false;
-        auto *o_ptr = &player_ptr->inventory_list[INVEN_ARMS];
-        auto flags = object_flags(o_ptr);
+        const auto *o_ptr = &player_ptr->inventory_list[INVEN_ARMS];
+        const auto flags = o_ptr->get_flags();
         auto should_mp_decrease = o_ptr->is_valid();
         should_mp_decrease &= flags.has_not(TR_FREE_ACT);
         should_mp_decrease &= flags.has_not(TR_DEC_MANA);
@@ -1060,14 +1059,12 @@ short calc_num_fire(PlayerType *player_ptr, const ItemEntity *o_ptr)
             continue;
         }
 
-        auto flags = object_flags(q_ptr);
-        if (flags.has(TR_XTRA_SHOTS)) {
+        if (q_ptr->get_flags().has(TR_XTRA_SHOTS)) {
             extra_shots++;
         }
     }
 
-    auto flags = object_flags(o_ptr);
-    if (flags.has(TR_XTRA_SHOTS)) {
+    if (o_ptr->get_flags().has(TR_XTRA_SHOTS)) {
         extra_shots++;
     }
 
@@ -1177,8 +1174,8 @@ static ACTION_SKILL_POWER calc_device_ability(PlayerType *player_ptr)
         if (!o_ptr->is_valid()) {
             continue;
         }
-        auto flags = object_flags(o_ptr);
-        if (flags.has(TR_MAGIC_MASTERY)) {
+
+        if (o_ptr->get_flags().has(TR_MAGIC_MASTERY)) {
             pow += 8 * o_ptr->pval;
         }
     }
@@ -1306,8 +1303,8 @@ static ACTION_SKILL_POWER calc_search(PlayerType *player_ptr)
         if (!o_ptr->is_valid()) {
             continue;
         }
-        auto flags = object_flags(o_ptr);
-        if (flags.has(TR_SEARCH)) {
+
+        if (o_ptr->get_flags().has(TR_SEARCH)) {
             pow += (o_ptr->pval * 5);
         }
     }
@@ -1357,8 +1354,8 @@ static ACTION_SKILL_POWER calc_search_freq(PlayerType *player_ptr)
         if (!o_ptr->is_valid()) {
             continue;
         }
-        auto flags = object_flags(o_ptr);
-        if (flags.has(TR_SEARCH)) {
+
+        if (o_ptr->get_flags().has(TR_SEARCH)) {
             pow += (o_ptr->pval * 5);
         }
     }
@@ -1495,8 +1492,8 @@ static ACTION_SKILL_POWER calc_skill_dig(PlayerType *player_ptr)
         if (!o_ptr->is_valid()) {
             continue;
         }
-        auto flags = object_flags(o_ptr);
-        if (flags.has(TR_TUNNEL)) {
+
+        if (o_ptr->get_flags().has(TR_TUNNEL)) {
             pow += (o_ptr->pval * 20);
         }
     }
@@ -1537,11 +1534,9 @@ static bool is_heavy_wield(PlayerType *player_ptr, int i)
 
 static int16_t calc_num_blow(PlayerType *player_ptr, int i)
 {
-    ItemEntity *o_ptr;
     int16_t num_blow = 1;
 
-    o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
-    auto flags = object_flags(o_ptr);
+    const auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
     PlayerClass pc(player_ptr);
     if (has_melee_weapon(player_ptr, INVEN_MAIN_HAND + i)) {
         if (o_ptr->is_valid() && !player_ptr->heavy_wield[i]) {
@@ -1553,7 +1548,7 @@ static int16_t calc_num_blow(PlayerType *player_ptr, int i)
             wgt = info.wgt;
             mul = info.mul;
 
-            if (pc.equals(PlayerClassType::CAVALRY) && player_ptr->riding && flags.has(TR_RIDING)) {
+            if (pc.equals(PlayerClassType::CAVALRY) && player_ptr->riding && o_ptr->get_flags().has(TR_RIDING)) {
                 num = 5;
                 wgt = 70;
                 mul = 4;
@@ -1786,9 +1781,8 @@ static ARMOUR_CLASS calc_to_ac(PlayerType *player_ptr, bool is_real_value)
     }
 
     for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
-        ItemEntity *o_ptr;
-        o_ptr = &player_ptr->inventory_list[i];
-        auto flags = object_flags(o_ptr);
+        const auto *o_ptr = &player_ptr->inventory_list[i];
+        const auto flags = o_ptr->get_flags();
         if (!o_ptr->is_valid()) {
             continue;
         }
@@ -1796,7 +1790,7 @@ static ARMOUR_CLASS calc_to_ac(PlayerType *player_ptr, bool is_real_value)
             ac += o_ptr->to_a;
         }
 
-        if (o_ptr->curse_flags.has(CurseTraitType::LOW_AC) || object_flags(o_ptr).has(TR_LOW_AC)) {
+        if (o_ptr->curse_flags.has(CurseTraitType::LOW_AC) || flags.has(TR_LOW_AC)) {
             if (o_ptr->curse_flags.has(CurseTraitType::HEAVY_CURSE)) {
                 if (is_real_value || o_ptr->is_fully_known()) {
                     ac -= 30;
@@ -1944,7 +1938,7 @@ int16_t calc_double_weapon_penalty(PlayerType *player_ptr, INVENTORY_IDX slot)
     int penalty = 0;
 
     if (has_melee_weapon(player_ptr, INVEN_MAIN_HAND) && has_melee_weapon(player_ptr, INVEN_SUB_HAND)) {
-        auto flags = object_flags(&player_ptr->inventory_list[INVEN_SUB_HAND]);
+        const auto flags = player_ptr->inventory_list[INVEN_SUB_HAND].get_flags();
 
         penalty = ((100 - player_ptr->skill_exp[PlayerSkillKindType::TWO_WEAPON] / 160) - (130 - player_ptr->inventory_list[slot].weight) / 8);
         if (set_quick_and_tiny(player_ptr) || set_icing_and_twinkle(player_ptr) || set_anubis_and_chariot(player_ptr)) {
@@ -2121,9 +2115,7 @@ static bool is_bare_knuckle(PlayerType *player_ptr)
 
 static short calc_to_damage(PlayerType *player_ptr, INVENTORY_IDX slot, bool is_real_value)
 {
-    auto *o_ptr = &player_ptr->inventory_list[slot];
-    auto flags = object_flags(o_ptr);
-
+    const auto *o_ptr = &player_ptr->inventory_list[slot];
     player_hand calc_hand = PLAYER_HAND_OTHER;
     if (slot == INVEN_MAIN_HAND) {
         calc_hand = PLAYER_HAND_MAIN;
@@ -2143,7 +2135,7 @@ static short calc_to_damage(PlayerType *player_ptr, INVENTORY_IDX slot, bool is_
     damage -= player_stun->get_damage_penalty();
     PlayerClass pc(player_ptr);
     const auto tval = o_ptr->bi_key.tval();
-    if (pc.equals(PlayerClassType::PRIEST) && (flags.has_not(TR_BLESSED)) && ((tval == ItemKindType::SWORD) || (tval == ItemKindType::POLEARM))) {
+    if (pc.equals(PlayerClassType::PRIEST) && (o_ptr->get_flags().has_not(TR_BLESSED)) && ((tval == ItemKindType::SWORD) || (tval == ItemKindType::POLEARM))) {
         damage -= 2;
     } else if (pc.equals(PlayerClassType::BERSERKER)) {
         damage += player_ptr->lev / 6;
@@ -2338,8 +2330,7 @@ static short calc_to_hit(PlayerType *player_ptr, INVENTORY_IDX slot, bool is_rea
     /* Bonuses and penalties by weapon */
     PlayerClass pc(player_ptr);
     if (has_melee_weapon(player_ptr, slot)) {
-        auto *o_ptr = &player_ptr->inventory_list[slot];
-        auto flags = object_flags(o_ptr);
+        const auto *o_ptr = &player_ptr->inventory_list[slot];
 
         /* Traind bonuses */
         const auto tval = o_ptr->bi_key.tval();
@@ -2361,6 +2352,7 @@ static short calc_to_hit(PlayerType *player_ptr, INVENTORY_IDX slot, bool is_rea
         }
 
         /* Riding bonus and penalty */
+        const auto flags = o_ptr->get_flags();
         if (player_ptr->riding > 0) {
             if (o_ptr->is_lance()) {
                 hit += 15;
index c60325f..d825412 100644 (file)
@@ -3,7 +3,6 @@
 #include "mind/mind-elementalist.h"
 #include "mutation/mutation-flag-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player-base/player-race.h"
 #include "player-info/race-info.h"
@@ -87,7 +86,7 @@ void known_obj_immunity(PlayerType *player_ptr, TrFlags &flags)
             continue;
         }
 
-        auto o_flags = object_flags_known(o_ptr);
+        auto o_flags = o_ptr->get_flags_known();
         if (o_flags.has(TR_IM_ACID)) {
             flags.set(TR_RES_ACID);
         }
index 43a1836..177af19 100644 (file)
@@ -26,7 +26,6 @@
 #include "object-hook/hook-armor.h"
 #include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "player/attack-defense-types.h"
 #include "player/player-skill.h"
 #include "player/player-status.h"
@@ -173,13 +172,11 @@ std::optional<std::string> do_hex_spell(PlayerType *player_ptr, spell_hex_type s
             }
 
             const auto item_name = describe_flavor(player_ptr, o_ptr, OD_NAME_ONLY);
-            auto f = object_flags(o_ptr);
-
             if (!input_check(format(_("本当に %s を呪いますか?", "Do you curse %s, really?"), item_name.data()))) {
                 return "";
             }
 
-            if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || f.has(TR_BLESSED))) {
+            if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || o_ptr->get_flags().has(TR_BLESSED))) {
                 msg_format(_("%s は呪いを跳ね返した。", "%s resists the effect."), item_name.data());
                 if (one_in_(3)) {
                     if (o_ptr->to_d > 0) {
@@ -528,13 +525,11 @@ std::optional<std::string> do_hex_spell(PlayerType *player_ptr, spell_hex_type s
 
             o_ptr = &player_ptr->inventory_list[item];
             const auto item_name = describe_flavor(player_ptr, o_ptr, OD_NAME_ONLY);
-            auto f = object_flags(o_ptr);
-
             if (!input_check(format(_("本当に %s を呪いますか?", "Do you curse %s, really?"), item_name.data()))) {
                 return "";
             }
 
-            if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || f.has(TR_BLESSED))) {
+            if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || o_ptr->get_flags().has(TR_BLESSED))) {
                 msg_format(_("%s は呪いを跳ね返した。", "%s resists the effect."), item_name.data());
                 if (one_in_(3)) {
                     if (o_ptr->to_d > 0) {
@@ -757,10 +752,8 @@ std::optional<std::string> do_hex_spell(PlayerType *player_ptr, spell_hex_type s
                 return "";
             }
 
-            auto f = object_flags(o_ptr);
-
             player_ptr->csp += (player_ptr->lev / 5) + randint1(player_ptr->lev / 5);
-            if (f.has(TR_TY_CURSE) || o_ptr->curse_flags.has(CurseTraitType::TY_CURSE)) {
+            if (o_ptr->get_flags().has(TR_TY_CURSE) || o_ptr->curse_flags.has(CurseTraitType::TY_CURSE)) {
                 player_ptr->csp += randint1(5);
             }
             if (player_ptr->csp > player_ptr->msp) {
index d598aa3..6aa592e 100644 (file)
@@ -28,7 +28,6 @@
 #include "monster/monster-info.h"
 #include "monster/monster-update.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-info/equipment-info.h"
 #include "player/player-damage.h"
 #include "player/player-move.h"
@@ -748,14 +747,13 @@ std::optional<std::string> do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s
                 o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
                 basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
                 damage = o_ptr->to_d * 100;
-                auto flags = object_flags(o_ptr);
 
                 // @todo ヴォーパルの多重定義.
                 if (o_ptr->is_specific_artifact(FixedArtifactId::VORPAL_BLADE) || o_ptr->is_specific_artifact(FixedArtifactId::CHAINSWORD)) {
                     /* vorpal blade */
                     basedam *= 5;
                     basedam /= 3;
-                } else if (flags.has(TR_VORPAL)) {
+                } else if (o_ptr->get_flags().has(TR_VORPAL)) {
                     /* vorpal flag only */
                     basedam *= 11;
                     basedam /= 9;
@@ -1065,14 +1063,13 @@ std::optional<std::string> do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s
                 o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
                 basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
                 damage = o_ptr->to_d * 100;
-                auto flags = object_flags(o_ptr);
 
                 // @todo ヴォーパルの多重定義.
                 if (o_ptr->is_specific_artifact(FixedArtifactId::VORPAL_BLADE) || o_ptr->is_specific_artifact(FixedArtifactId::CHAINSWORD)) {
                     /* vorpal blade */
                     basedam *= 5;
                     basedam /= 3;
-                } else if (flags.has(TR_VORPAL)) {
+                } else if (o_ptr->get_flags().has(TR_VORPAL)) {
                     /* vorpal flag only */
                     basedam *= 11;
                     basedam /= 9;
index 369efa2..7f08226 100644 (file)
@@ -3,7 +3,6 @@
 #include "object-enchant/tr-flags.h"
 #include "object-enchant/tr-types.h"
 #include "object/item-tester-hooker.h"
-#include "object/object-flags.h"
 #include "perception/object-perception.h"
 #include "player-base/player-class.h"
 #include "player-info/smith-data-type.h"
@@ -303,7 +302,7 @@ int Smith::get_essence_num_of_posessions(SmithEssenceType essence) const
 Smith::DrainEssenceResult Smith::drain_essence(ItemEntity *o_ptr)
 {
     // 抽出量を揃えるためKILLフラグのみ付いている場合はSLAYフラグも付ける
-    auto old_flags = object_flags(o_ptr);
+    auto old_flags = o_ptr->get_flags();
     if (old_flags.has(TR_KILL_DRAGON)) {
         old_flags.set(TR_SLAY_DRAGON);
     }
@@ -365,7 +364,7 @@ Smith::DrainEssenceResult Smith::drain_essence(ItemEntity *o_ptr)
     object_aware(player_ptr, o_ptr);
     object_known(o_ptr);
 
-    auto new_flags = object_flags(o_ptr);
+    const auto new_flags = o_ptr->get_flags();
 
     std::unordered_map<SmithEssenceType, int> drain_values;
 
index 888f272..a675d82 100644 (file)
@@ -1,6 +1,5 @@
 #include "smith/smith-info.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "smith/smith-types.h"
 #include "sv-definition/sv-weapon-types.h"
@@ -39,8 +38,7 @@ bool BasicSmithInfo::add_essence(PlayerType *, ItemEntity *o_ptr, int) const
 void BasicSmithInfo::erase_essence(ItemEntity *o_ptr) const
 {
     o_ptr->smith_effect = std::nullopt;
-    auto flags = object_flags(o_ptr);
-    if (flags.has_none_of(TR_PVAL_FLAG_MASK)) {
+    if (o_ptr->get_flags().has_none_of(TR_PVAL_FLAG_MASK)) {
         o_ptr->pval = 0;
     }
 }
index f570f26..0b2b00e 100644 (file)
@@ -12,7 +12,6 @@
 #include "main/sound-definitions-table.h"
 #include "main/sound-of-music.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-attack/player-attack.h"
 #include "player-base/player-class.h"
 #include "player-info/race-info.h"
@@ -149,7 +148,7 @@ void process_death_scythe_reflection(PlayerType *player_ptr, player_attack_type
     msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
 
     auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + pa_ptr->hand];
-    auto death_scythe_flags = object_flags(o_ptr);
+    const auto death_scythe_flags = o_ptr->get_flags();
     pa_ptr->attack_damage = damroll(o_ptr->dd + player_ptr->to_dd[pa_ptr->hand], o_ptr->ds + player_ptr->to_ds[pa_ptr->hand]);
     int magnification = calc_death_scythe_reflection_magnification(player_ptr);
     compensate_death_scythe_reflection_magnification(player_ptr, &magnification, death_scythe_flags);
index e286365..b524ce3 100644 (file)
@@ -6,7 +6,6 @@
 #include "mind/mind-ninja.h"
 #include "object-enchant/object-ego.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "player/special-defense-types.h"
 #include "sv-definition/sv-lite-types.h"
@@ -90,10 +89,7 @@ void update_lite_radius(PlayerType *player_ptr)
 {
     player_ptr->cur_lite = 0;
     for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
-        ItemEntity *o_ptr;
-        o_ptr = &player_ptr->inventory_list[i];
-        auto flags = object_flags(o_ptr);
-
+        const auto *o_ptr = &player_ptr->inventory_list[i];
         if (!o_ptr->is_valid()) {
             continue;
         }
@@ -102,6 +98,7 @@ void update_lite_radius(PlayerType *player_ptr)
             player_ptr->cur_lite++;
         }
 
+        const auto flags = o_ptr->get_flags();
         if (flags.has_not(TR_DARK_SOURCE)) {
             if (o_ptr->bi_key.tval() == ItemKindType::LITE) {
                 const auto sval = o_ptr->bi_key.sval();
index cf01ac4..7f46a24 100644 (file)
@@ -29,7 +29,6 @@
 #include "monster/monster-update.h"
 #include "mutation/mutation-flag-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-class.h"
 #include "player/player-move.h"
 #include "player/player-status.h"
@@ -561,12 +560,9 @@ void teleport_away_followable(PlayerType *player_ptr, MONSTER_IDX m_idx)
 
         for (i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
             o_ptr = &player_ptr->inventory_list[i];
-            if (o_ptr->is_valid() && !o_ptr->is_cursed()) {
-                auto flags = object_flags(o_ptr);
-                if (flags.has(TR_TELEPORT)) {
-                    follow = true;
-                    break;
-                }
+            if (o_ptr->is_valid() && !o_ptr->is_cursed() && o_ptr->get_flags().has(TR_TELEPORT)) {
+                follow = true;
+                break;
             }
         }
     }
index c93afe5..b4d0291 100644 (file)
@@ -10,7 +10,6 @@
 #include "io/input-key-acceptor.h"
 #include "object-enchant/object-ego.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "player-info/equipment-info.h"
 #include "player/attack-defense-types.h"
 #include "player/special-defense-types.h"
index 46cc328..3d771e3 100644 (file)
@@ -2,7 +2,6 @@
 #include "monster-race/monster-race.h"
 #include "monster-race/race-flags3.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/object-value.h"
 #include "object/tval-types.h"
 #include "store/store-util.h"
@@ -23,8 +22,7 @@
  */
 static bool is_blessed_item(const ItemEntity *item_ptr)
 {
-    auto flags = object_flags(item_ptr);
-    return flags.has(TR_BLESSED);
+    return item_ptr->get_flags().has(TR_BLESSED);
 }
 
 static bool check_store_general(const ItemEntity &item)
index ac2cd0a..c0ff135 100644 (file)
@@ -12,7 +12,6 @@
 #include "monster-race/monster-race.h"
 #include "object-enchant/object-curse.h"
 #include "object-enchant/special-object-flags.h"
-#include "object/object-flags.h"
 #include "object/object-value.h"
 #include "object/tval-types.h"
 #include "smith/object-smith.h"
@@ -493,7 +492,7 @@ bool ItemEntity::is_activatable() const
         return false;
     }
 
-    auto flags = object_flags(this);
+    const auto flags = this->get_flags();
     return flags.has(TR_ACTIVATE);
 }
 
@@ -820,3 +819,103 @@ ArtifactType &ItemEntity::get_fixed_artifact() const
 {
     return ArtifactsInfo::get_instance().get_artifact(this->fixed_artifact_idx);
 }
+
+TrFlags ItemEntity::get_flags() const
+{
+    const auto &baseitem = this->get_baseitem();
+    auto flags = baseitem.flags;
+
+    if (this->is_fixed_artifact()) {
+        flags = this->get_fixed_artifact().flags;
+    }
+
+    if (this->is_ego()) {
+        const auto &ego = this->get_ego();
+        flags.set(ego.flags);
+        this->modify_ego_lite_flags(flags);
+    }
+
+    flags.set(this->art_flags);
+    if (auto effect = Smith::object_effect(this); effect.has_value()) {
+        auto tr_flags = Smith::get_effect_tr_flags(effect.value());
+        flags.set(tr_flags);
+    }
+
+    if (Smith::object_activation(this).has_value()) {
+        flags.set(TR_ACTIVATE);
+    }
+
+    return flags;
+}
+
+TrFlags ItemEntity::get_flags_known() const
+{
+    TrFlags flags{};
+    if (!this->is_aware()) {
+        return flags;
+    }
+
+    const auto &baseitem = this->get_baseitem();
+    flags = baseitem.flags;
+    if (!this->is_known()) {
+        return flags;
+    }
+
+    if (this->is_ego()) {
+        const auto &ego = this->get_ego();
+        flags.set(ego.flags);
+        this->modify_ego_lite_flags(flags);
+    }
+
+    if (this->is_fully_known()) {
+        if (this->is_fixed_artifact()) {
+            flags = this->get_fixed_artifact().flags;
+        }
+
+        flags.set(this->art_flags);
+    }
+
+    if (auto effect = Smith::object_effect(this); effect.has_value()) {
+        auto tr_flags = Smith::get_effect_tr_flags(effect.value());
+        flags.set(tr_flags);
+    }
+
+    if (Smith::object_activation(this).has_value()) {
+        flags.set(TR_ACTIVATE);
+    }
+
+    return flags;
+}
+
+/*!
+ * @brief エゴ光源のフラグを修正する
+ *
+ * 寿命のある光源で寿命が0ターンの時、光源エゴアイテムに起因するフラグは
+ * 灼熱エゴの火炎耐性を除き付与されないようにする。
+ *
+ * @param flags フラグ情報を受け取る配列
+ */
+void ItemEntity::modify_ego_lite_flags(TrFlags &flags) const
+{
+    if (this->bi_key.tval() != ItemKindType::LITE) {
+        return;
+    }
+
+    if (!this->is_lite_requiring_fuel() || this->fuel != 0) {
+        return;
+    }
+
+    switch (this->ego_idx) {
+    case EgoType::LITE_AURA_FIRE:
+        flags.reset(TR_SH_FIRE);
+        return;
+    case EgoType::LITE_INFRA:
+        flags.reset(TR_INFRA);
+        return;
+    case EgoType::LITE_EYE:
+        flags.reset({ TR_RES_BLIND, TR_SEE_INVIS });
+        return;
+    default:
+        return;
+    }
+}
index f20a7fd..ad5bdd9 100644 (file)
@@ -140,9 +140,12 @@ public:
     BaseitemInfo &get_baseitem() const;
     EgoItemDefinition &get_ego() const;
     ArtifactType &get_fixed_artifact() const;
+    TrFlags get_flags() const;
+    TrFlags get_flags_known() const;
 
 private:
     int get_baseitem_price() const;
     int calc_figurine_value() const;
     int calc_capture_value() const;
+    void modify_ego_lite_flags(TrFlags &flags) const;
 };
index 8ba7805..5f625c6 100644 (file)
@@ -12,7 +12,6 @@
 #include "object-enchant/special-object-flags.h"
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
 #include "perception/object-perception.h"
 #include "player/permanent-resistances.h"
 #include "player/race-resistances.h"
@@ -110,7 +109,7 @@ static void process_cursed_equipment_characteristics(PlayerType *player_ptr, uin
         auto *o_ptr = &player_ptr->inventory_list[i];
         auto is_known = o_ptr->is_known();
         auto is_sensed = is_known || o_ptr->ident & IDENT_SENSE;
-        auto flags = object_flags_known(o_ptr);
+        auto flags = o_ptr->get_flags_known();
 
         if (flags.has(TR_ADD_L_CURSE) || flags.has(TR_ADD_H_CURSE)) {
             if (is_known) {
@@ -157,7 +156,7 @@ static void process_light_equipment_characteristics(PlayerType *player_ptr, all_
     int max_i = (mode & DP_WP) ? INVEN_BOW + 1 : INVEN_TOTAL;
     for (int i = INVEN_MAIN_HAND; i < max_i; i++) {
         auto *o_ptr = &player_ptr->inventory_list[i];
-        auto flags = object_flags_known(o_ptr);
+        auto flags = o_ptr->get_flags_known();
 
         auto b = false;
         for (auto flg : lite_flags) {
@@ -206,7 +205,7 @@ static void process_inventory_characteristic(PlayerType *player_ptr, tr_type fla
     int max_i = (mode & DP_WP) ? INVEN_BOW + 1 : INVEN_TOTAL;
     for (int i = INVEN_MAIN_HAND; i < max_i; i++) {
         auto *o_ptr = &player_ptr->inventory_list[i];
-        auto flags = object_flags_known(o_ptr);
+        auto flags = o_ptr->get_flags_known();
 
         auto f_imm = flag_to_greater_flag.find(flag);
         if (f_imm != flag_to_greater_flag.end()) {
index f0a848a..eb54221 100644 (file)
@@ -10,7 +10,6 @@
 #include "inventory/inventory-slot-types.h"
 #include "mutation/mutation-flag-types.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "player-base/player-race.h"
 #include "player-info/class-info.h"
 #include "player-info/mimic-info-table.h"
@@ -209,7 +208,7 @@ static void display_equipments_compensation(PlayerType *player_ptr, int row, int
     for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
         ItemEntity *o_ptr;
         o_ptr = &player_ptr->inventory_list[i];
-        auto flags = object_flags_known(o_ptr);
+        auto flags = o_ptr->get_flags_known();
         for (int stat = 0; stat < A_MAX; stat++) {
             TERM_COLOR a = TERM_SLATE;
             char c = '.';
index ec085c3..cca56ac 100644 (file)
@@ -14,7 +14,6 @@
 #include "mutation/mutation-flag-types.h"
 #include "object-enchant/special-object-flags.h"
 #include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
 #include "object/tval-types.h"
 #include "perception/object-perception.h"
 #include "player-base/player-class.h"
@@ -276,7 +275,7 @@ static void calc_two_hands(PlayerType *player_ptr, int *damage, int *to_h)
         }
 
         basedam = ((o_ptr->dd + player_ptr->to_dd[i]) * (o_ptr->ds + player_ptr->to_ds[i] + 1)) * 50;
-        auto flags = object_flags_known(o_ptr);
+        auto flags = o_ptr->get_flags_known();
 
         bool impact = player_ptr->impact != 0;
         basedam = calc_expect_crit(player_ptr, o_ptr->weight, to_h[i], basedam, player_ptr->dis_to_h[i], poison_needle, impact);
index 8639afb..009805e 100644 (file)
@@ -5,7 +5,6 @@
 #include "object-enchant/object-ego.h"
 #include "object-enchant/trc-types.h"
 #include "object-enchant/trg-types.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "system/artifact-type-definition.h"
 #include "system/item-entity.h"
@@ -36,7 +35,7 @@ static std::string analyze_general(PlayerType *player_ptr, const ItemEntity *o_p
  */
 static std::vector<std::string> analyze_slay(const ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     return extract_spoiler_flags(flags, slay_flags_desc);
 }
 
@@ -48,7 +47,7 @@ static std::vector<std::string> analyze_slay(const ItemEntity *o_ptr)
  */
 static std::vector<std::string> analyze_brand(const ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     return extract_spoiler_flags(flags, brand_flags_desc);
 }
 
@@ -60,7 +59,7 @@ static std::vector<std::string> analyze_brand(const ItemEntity *o_ptr)
  */
 static std::vector<std::string> analyze_resist(const ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     return extract_spoiler_flags(flags, resist_flags_desc);
 }
 
@@ -72,7 +71,7 @@ static std::vector<std::string> analyze_resist(const ItemEntity *o_ptr)
  */
 static std::vector<std::string> analyze_immune(const ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     return extract_spoiler_flags(flags, immune_flags_desc);
 }
 
@@ -84,7 +83,7 @@ static std::vector<std::string> analyze_immune(const ItemEntity *o_ptr)
  */
 static std::vector<std::string> analyze_vulnerable(const ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     return extract_spoiler_flags(flags, vulnerable_flags_desc);
 }
 
@@ -96,7 +95,7 @@ static std::vector<std::string> analyze_vulnerable(const ItemEntity *o_ptr)
  */
 static std::vector<std::string> analyze_sustains(const ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     if (flags.has_all_of(EnumRange(TR_SUST_STR, TR_SUST_CHR))) {
         return { _("全能力", "All stats") };
     }
@@ -118,7 +117,7 @@ static std::vector<std::string> analyze_sustains(const ItemEntity *o_ptr)
 static std::vector<std::string> analyze_misc_magic(const ItemEntity *o_ptr)
 {
     std::vector<std::string> descriptions{};
-    auto flags = object_flags(o_ptr);
+    const auto flags = o_ptr->get_flags();
     const auto &flags2_descriptions = extract_spoiler_flags(flags, misc_flags2_desc);
     descriptions.insert(descriptions.end(), flags2_descriptions.begin(), flags2_descriptions.end());
     const auto &flags3_descriptions = extract_spoiler_flags(flags, misc_flags3_desc);
@@ -252,22 +251,23 @@ static std::string analyze_misc(const ItemEntity *o_ptr)
  * @brief アーティファクトの情報全体を構造体に収める
  * @param player_ptr プレイヤーへの参照ポインタ
  * @param o_ptr オブジェクト構造体の参照ポインタ
- * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
  */
-void object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr)
+ArtifactsDumpInfo object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr)
 {
-    desc_ptr->description = analyze_general(player_ptr, o_ptr);
-    desc_ptr->pval_info.analyze(*o_ptr);
-    desc_ptr->brands = analyze_brand(o_ptr);
-    desc_ptr->slays = analyze_slay(o_ptr);
-    desc_ptr->immunities = analyze_immune(o_ptr);
-    desc_ptr->resistances = analyze_resist(o_ptr);
-    desc_ptr->vulnerabilities = analyze_vulnerable(o_ptr);
-    desc_ptr->sustenances = analyze_sustains(o_ptr);
-    desc_ptr->misc_magic = analyze_misc_magic(o_ptr);
-    desc_ptr->addition = analyze_addition(o_ptr);
-    desc_ptr->misc_desc = analyze_misc(o_ptr);
-    desc_ptr->activation = activation_explanation(o_ptr);
+    ArtifactsDumpInfo info{};
+    info.description = analyze_general(player_ptr, o_ptr);
+    info.pval_info.analyze(*o_ptr);
+    info.brands = analyze_brand(o_ptr);
+    info.slays = analyze_slay(o_ptr);
+    info.immunities = analyze_immune(o_ptr);
+    info.resistances = analyze_resist(o_ptr);
+    info.vulnerabilities = analyze_vulnerable(o_ptr);
+    info.sustenances = analyze_sustains(o_ptr);
+    info.misc_magic = analyze_misc_magic(o_ptr);
+    info.addition = analyze_addition(o_ptr);
+    info.misc_desc = analyze_misc(o_ptr);
+    info.activation = activation_explanation(o_ptr);
+    return info;
 }
 
 /*!
@@ -276,20 +276,22 @@ void object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_li
  * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
  * @param desc_ptr 記述内容を収める構造体参照ポインタ
  */
-void random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr)
+ArtifactsDumpInfo random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr)
 {
-    desc_ptr->description = analyze_general(player_ptr, o_ptr);
-    desc_ptr->pval_info.analyze(*o_ptr);
-    desc_ptr->brands = analyze_brand(o_ptr);
-    desc_ptr->slays = analyze_slay(o_ptr);
-    desc_ptr->immunities = analyze_immune(o_ptr);
-    desc_ptr->resistances = analyze_resist(o_ptr);
-    desc_ptr->vulnerabilities = analyze_vulnerable(o_ptr);
-    desc_ptr->sustenances = analyze_sustains(o_ptr);
-    desc_ptr->misc_magic = analyze_misc_magic(o_ptr);
-    desc_ptr->activation = activation_explanation(o_ptr);
+    ArtifactsDumpInfo info{};
+    info.description = analyze_general(player_ptr, o_ptr);
+    info.pval_info.analyze(*o_ptr);
+    info.brands = analyze_brand(o_ptr);
+    info.slays = analyze_slay(o_ptr);
+    info.immunities = analyze_immune(o_ptr);
+    info.resistances = analyze_resist(o_ptr);
+    info.vulnerabilities = analyze_vulnerable(o_ptr);
+    info.sustenances = analyze_sustains(o_ptr);
+    info.misc_magic = analyze_misc_magic(o_ptr);
+    info.activation = activation_explanation(o_ptr);
     constexpr auto weight_mes = _("重さ %d.%d kg", "Weight %d.%d lbs");
     const auto weight_integer = _(lb_to_kg_integer(o_ptr->weight), o_ptr->weight / 10);
     const auto weight_fraction = _(lb_to_kg_fraction(o_ptr->weight), o_ptr->weight % 10);
-    desc_ptr->misc_desc = format(weight_mes, weight_integer, weight_fraction);
+    info.misc_desc = format(weight_mes, weight_integer, weight_fraction);
+    return info;
 }
index 86e511b..6b422b8 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once
 
 class ItemEntity;
-struct obj_desc_list;
+class ArtifactsDumpInfo;
 class PlayerType;
-void object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr);
-void random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr);
+ArtifactsDumpInfo object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr);
+ArtifactsDumpInfo random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr);
index 67adea9..fd55571 100644 (file)
@@ -24,38 +24,45 @@ void spoiler_outlist(std::string_view header, const std::vector<std::string> &de
         return;
     }
 
-    std::string line = spoiler_indent;
+    std::stringstream line;
+    line << spoiler_indent;
     if (!header.empty()) {
-        line.append(header).append(" ");
+        line << header << " ";
     }
 
     std::stringstream ss;
     ss << list_separator << ' ';
     const auto last_separator = ss.str();
     for (size_t i = 0; i < descriptions.size(); i++) {
-        auto elem = descriptions[i];
+        std::stringstream element;
+        element << descriptions[i];
         if (i < descriptions.size() - 1) {
-            elem.push_back(separator);
-            elem.push_back(' ');
+            element << separator << ' ';
         }
 
-        if (line.length() + elem.length() <= MAX_LINE_LEN) {
-            line.append(elem);
+        const auto element_str = element.str();
+        const int line_length = line.tellp();
+        constexpr auto max_line_length = 75;
+        if (line_length + element_str.length() <= max_line_length) {
+            line << element_str;
             continue;
         }
 
-        if (line.length() > 1 && line.ends_with(last_separator)) {
-            ofs << std::string_view(line).substr(0, line.length() - 2) << '\n';
-            line = spoiler_indent;
-            line.append(elem);
+        const auto line_str = line.str();
+        if (line_str.ends_with(last_separator)) {
+            ofs << std::string_view(line_str).substr(0, line_str.length() - 2) << '\n';
+            line.str("");
+            line.clear(std::stringstream::goodbit);
+            line << spoiler_indent << element_str;
         } else {
-            ofs << line << '\n';
-            line = "      ";
-            line.append(elem);
+            ofs << line_str << '\n';
+            line.str("");
+            line.clear(std::stringstream::goodbit);
+            line << "      " << element_str;
         }
     }
 
-    ofs << line << '\n';
+    ofs << line.str() << '\n';
 }
 
 /*!
@@ -86,7 +93,7 @@ static ItemEntity make_fake_artifact(FixedArtifactId fixed_artifact_idx)
  * Create a spoiler file entry for an artifact
  * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
  */
-static void spoiler_print_art(obj_desc_list *art_ptr, std::ofstream &ofs)
+static void spoiler_print_art(const ArtifactsDumpInfo *art_ptr, std::ofstream &ofs)
 {
     const auto *pval_ptr = &art_ptr->pval_info;
     ofs << art_ptr->description << '\n';
@@ -143,9 +150,8 @@ SpoilerOutputResultType spoil_fixed_artifact()
 
                 const auto item = make_fake_artifact(a_idx);
                 PlayerType dummy;
-                obj_desc_list artifact_descriptions;
-                object_analyze(&dummy, &item, &artifact_descriptions);
-                spoiler_print_art(&artifact_descriptions, ofs);
+                const auto artifacts_list = object_analyze(&dummy, &item);
+                spoiler_print_art(&artifacts_list, ofs);
             }
         }
     }
index 27dd440..19dedc3 100644 (file)
@@ -1,5 +1,4 @@
 #include "wizard/spoiler-util.h"
-#include "object/object-flags.h"
 #include "system/item-entity.h"
 #include <fstream>
 
@@ -250,7 +249,7 @@ void ParameterValueInfo::analyze(const ItemEntity &item)
         return;
     }
 
-    auto flags = object_flags(&item);
+    const auto flags = item.get_flags();
     this->pval_desc = format("%+d", item.pval);
     if (flags.has_all_of(EnumRange(TR_STR, TR_CHR))) {
         this->pval_affects.push_back(_("全能力", "All stats"));
index ce7f97f..54b3117 100644 (file)
@@ -8,9 +8,6 @@
 #include <string_view>
 #include <vector>
 
-/* MAX_LINE_LEN specifies when a line should wrap. */
-#define MAX_LINE_LEN 75
-
 enum class SpoilerOutputResultType {
     CANCELED,
     SUCCESSFUL,
@@ -31,7 +28,9 @@ public:
     void analyze(const ItemEntity &item);
 };
 
-struct obj_desc_list {
+class ArtifactsDumpInfo {
+public:
+    ArtifactsDumpInfo() = default;
     std::string description = ""; /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
     ParameterValueInfo pval_info{}; /* Description of what is affected by an object's pval */
     std::vector<std::string> slays{}; /* A list of an object's slaying preferences */
index 357a280..44e2045 100644 (file)
@@ -20,7 +20,6 @@
 #include "object-enchant/special-object-flags.h"
 #include "object-enchant/tr-types.h"
 #include "object/item-use-flags.h"
-#include "object/object-flags.h"
 #include "object/object-info.h"
 #include "object/object-kind-hook.h"
 #include "object/object-mark-types.h"
@@ -381,7 +380,6 @@ static void prt_binary(BIT_FLAGS flags, const int row, int col)
  */
 static void wiz_display_item(PlayerType *player_ptr, ItemEntity *o_ptr)
 {
-    auto flags = object_flags(o_ptr);
     auto get_seq_32bits = [](const TrFlags &flags, uint start) {
         BIT_FLAGS result = 0U;
         for (auto i = 0U; i < 32 && start + i < flags.size(); i++) {
@@ -413,6 +411,7 @@ static void wiz_display_item(PlayerType *player_ptr, ItemEntity *o_ptr)
     prt(format("cursed  = %-4lX  captured_monster_speed = %-4d", o_ptr->curse_flags.to_ulong(), o_ptr->captured_monster_speed), ++line, j);
     prt(format("captured_monster_max_hp = %-4d  captured_monster_max_hp = %-4d", o_ptr->captured_monster_current_hp, o_ptr->captured_monster_max_hp), ++line, j);
 
+    const auto flags = o_ptr->get_flags();
     prt("+------------FLAGS1------------+", ++line, j);
     prt("AFFECT........SLAY........BRAND.", ++line, j);
     prt("      mf      cvae      xsqpaefc", ++line, j);