OSDN Git Service

[Refactor] #40399 Separated object-appraiser.c/h from object2.c/h
authorHourier <hourier@users.sourceforge.jp>
Mon, 1 Jun 2020 13:31:13 +0000 (22:31 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 1 Jun 2020 13:31:13 +0000 (22:31 +0900)
29 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/birth/inventory-initializer.c
src/cmd-item/cmd-eat.c
src/cmd-item/cmd-quaff.c
src/cmd-item/cmd-read.c
src/cmd-item/cmd-smith.c
src/cmd-item/cmd-usestaff.c
src/cmd-item/cmd-zaprod.c
src/cmd-item/cmd-zapwand.c
src/effect/effect-item.c
src/effect/effect-item.h
src/floor/floor-object.c
src/market/bounty.c
src/market/bounty.h
src/object/artifact.c
src/object/chest.c
src/object/object-appraiser.c [new file with mode: 0644]
src/object/object-appraiser.h [new file with mode: 0644]
src/object/object2.c
src/object/object2.h
src/player/player-move.c
src/player/process-death.c
src/spell/spells-object.c
src/spell/spells3.c
src/store/store-util.c
src/store/store.c
src/wizard/wizard-special-process.c

index 2e1ff20..302b160 100644 (file)
     <ClCompile Include="..\..\src\mind\racial-samurai.c" />\r
     <ClCompile Include="..\..\src\mind\samurai-slaying.c" />\r
     <ClCompile Include="..\..\src\mind\surprise-attack.c" />\r
+    <ClCompile Include="..\..\src\object\object-appraiser.c" />\r
     <ClCompile Include="..\..\src\pet\pet-fall-off.c" />\r
     <ClCompile Include="..\..\src\mspell\mspell-floor.c" />\r
     <ClCompile Include="..\..\src\mspell\mspell-particularity.c" />\r
     <ClInclude Include="..\..\src\mind\racial-samurai.h" />\r
     <ClInclude Include="..\..\src\mind\samurai-slaying.h" />\r
     <ClInclude Include="..\..\src\mind\surprise-attack.h" />\r
+    <ClInclude Include="..\..\src\object\object-appraiser.h" />\r
     <ClInclude Include="..\..\src\pet\pet-fall-off.h" />\r
     <ClInclude Include="..\..\src\pet\pet-util.h" />\r
     <ClInclude Include="..\..\src\mspell\assign-monster-spell.h" />\r
index cf63d12..e6e3c29 100644 (file)
     <ClCompile Include="..\..\src\view\object-describer.c">
       <Filter>view</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\object\object-appraiser.c">
+      <Filter>object</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\view\object-describer.h">
       <Filter>view</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\object\object-appraiser.h">
+      <Filter>object</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 2af01e8..e13bacd 100644 (file)
@@ -294,6 +294,7 @@ hengband_SOURCES = \
        object/death-scythe.c object/death-scythe.h \
        object/object1.c object/object1.h \
        object/object2.c object/object2.h \
+       object/object-appraiser.c object/object-appraiser.h \
        object/object-boost.c object/object-boost.h \
        object/object-broken.c object/object-broken.h \
        object/object-curse.c object/object-curse.h \
index 20bf2a0..5f51d30 100644 (file)
@@ -3,6 +3,7 @@
 #include "birth/initial-equipments-table.h"
 #include "monster/monster-race-hook.h"
 #include "object/item-apply-magic.h"
+#include "object/object-appraiser.h"
 #include "object/object-ego.h"
 #include "object/object-kind.h"
 #include "object/object2.h"
index f90021d..2693932 100644 (file)
@@ -9,6 +9,7 @@
 #include "inventory/player-inventory.h"
 #include "main/sound-definitions-table.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
index ad5c4a9..97ab440 100644 (file)
@@ -12,6 +12,7 @@
 #include "main/sound-definitions-table.h"
 #include "mutation/mutation.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-broken.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
index 213c36a..c1dcabe 100644 (file)
@@ -13,6 +13,7 @@
 #include "main/sound-definitions-table.h"
 #include "object/artifact.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
index 7ce8a82..f3d940b 100644 (file)
@@ -5,20 +5,21 @@
  */
 
 #include "cmd-item/cmd-smith.h"
-#include "util/util.h"
-#include "term/gameterm.h"
+#include "autopick/autopick.h"
+#include "cmd/cmd-basic.h"
+#include "inventory/player-inventory.h"
 #include "object/item-use-flags.h"
-#include "object/object2.h"
+#include "object/object-appraiser.h"
+#include "object/object-ego.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
-#include "object/object-ego.h"
+#include "object/object2.h"
 #include "object/special-object-flags.h"
-#include "player/player-status.h"
-#include "cmd/cmd-basic.h"
-#include "autopick/autopick.h"
-#include "inventory/player-inventory.h"
 #include "object/tr-types.h"
 #include "object/trc-types.h"
+#include "player/player-status.h"
+#include "term/gameterm.h"
+#include "util/util.h"
 #include "view/display-main-window.h"
 
 /*!
index 1f9d382..b069725 100644 (file)
@@ -4,6 +4,7 @@
 #include "inventory/player-inventory.h"
 #include "main/sound-definitions-table.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
 #include "object/object2.h"
index e21380b..11ec3ce 100644 (file)
@@ -5,9 +5,9 @@
 #include "io/targeting.h"
 #include "main/sound-definitions-table.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
-#include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-other-types.h"
 #include "object/sv-rod-types.h"
index 144a98c..42baf37 100644 (file)
@@ -5,6 +5,7 @@
 #include "io/targeting.h"
 #include "main/sound-definitions-table.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
 #include "object/object2.h"
index b55d2b7..0168b81 100644 (file)
@@ -1,16 +1,16 @@
-#include "system/angband.h"
-#include "effect-item.h"
-#include "object/object2.h"
+#include "effect-item.h"
+#include "autopick/autopick.h"
+#include "object/object-appraiser.h"
+#include "object/object-broken.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
-#include "object/object-broken.h"
+#include "object/object-mark-types.h"
+#include "object/object2.h"
 #include "object/sv-other-types.h"
 #include "object/sv-scroll-types.h"
-#include "autopick/autopick.h"
+#include "object/tr-types.h"
 #include "spell/spells-type.h"
 #include "spell/spells3.h"
-#include "object/tr-types.h"
-#include "object/object-mark-types.h"
 
 /*!
  * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
index 5802304..8b7c581 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "system/angband.h"
+
 bool affect_item(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ);
index 1bd9980..ffea8b9 100644 (file)
@@ -8,6 +8,7 @@
 #include "floor/floor.h"
 #include "object/artifact.h"
 #include "object/item-apply-magic.h"
+#include "object/object-appraiser.h"
 #include "object/object-flavor.h"
 #include "object/object-kind-hook.h"
 #include "object/object-kind.h"
index 644f053..e6fb880 100644 (file)
@@ -1,18 +1,18 @@
-#include "system/angband.h"
-#include "market/bounty.h"
-#include "world/world.h"
-#include "player/avatar.h"
-#include "market/bounty-prize-table.h"
-#include "object/item-apply-magic.h"
-#include "object/object2.h"
-#include "object/object-flavor.h"
+#include "market/bounty.h"
 #include "autopick/autopick.h"
 #include "core/stuff-handler.h"
-#include "term/gameterm.h"
-#include "market/building-util.h"
 #include "dungeon/dungeon.h"
+#include "market/bounty-prize-table.h"
+#include "market/building-util.h"
 #include "monster/monster-race-hook.h"
+#include "object/item-apply-magic.h"
+#include "object/object-appraiser.h"
+#include "object/object-flavor.h"
+#include "object/object2.h"
 #include "object/sv-other-types.h"
+#include "player/avatar.h"
+#include "term/gameterm.h"
+#include "world/world.h"
 
 /*!
  * @brief 賞金首の引き換え処理 / Get prize
index 6b2f481..21cd24c 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "system/angband.h"
+
 bool exchange_cash(player_type *player_ptr);
 void today_target(player_type *player_ptr);
 void tsuchinoko(void);
index 0e91d6a..8050da4 100644 (file)
@@ -17,6 +17,7 @@
 #include "grid/grid.h"
 #include "io/files-util.h"
 #include "monster/monster.h"
+#include "object/object-appraiser.h"
 #include "object/object-boost.h"
 #include "object/object-curse.h"
 #include "object/object-ego.h"
index 826e1f3..4976c2c 100644 (file)
@@ -5,6 +5,7 @@
 #include "grid/trap.h"
 #include "main/sound-definitions-table.h"
 #include "object/item-apply-magic.h"
+#include "object/object-appraiser.h"
 #include "object/object2.h"
 #include "object/sv-other-types.h"
 #include "player/player-class.h"
diff --git a/src/object/object-appraiser.c b/src/object/object-appraiser.c
new file mode 100644 (file)
index 0000000..c1612da
--- /dev/null
@@ -0,0 +1,73 @@
+#include "object/object-appraiser.h"
+#include "io/write-diary.h"
+#include "object/artifact.h"
+#include "object/item-feeling.h"
+#include "object/object-flavor.h"
+#include "object/object-hook.h" // 暫定、このファイルへ引っ越す.
+#include "object/object-kind.h"
+#include "object/object2.h" // 暫定、相互参照している.
+#include "object/special-object-flags.h"
+
+/*!
+ * @brief オブジェクトを鑑定済にする /
+ * Known is true when the "attributes" of an object are "known".
+ * @param o_ptr 鑑定済にするオブジェクトの構造体参照ポインタ
+ * @return なし
+ * These include tohit, todam, toac, cost, and pval (charges).\n
+ *\n
+ * Note that "knowing" an object gives you everything that an "awareness"\n
+ * gives you, and much more.  In fact, the player is always "aware" of any\n
+ * item of which he has full "knowledge".\n
+ *\n
+ * But having full knowledge of, say, one "wand of wonder", does not, by\n
+ * itself, give you knowledge, or even awareness, of other "wands of wonder".\n
+ * It happens that most "identify" routines (including "buying from a shop")\n
+ * will make the player "aware" of the object as well as fully "know" it.\n
+ *\n
+ * This routine also removes any inscriptions generated by "feelings".\n
+ */
+void object_known(object_type *o_ptr)
+{
+    o_ptr->feeling = FEEL_NONE;
+    o_ptr->ident &= ~(IDENT_SENSE);
+    o_ptr->ident &= ~(IDENT_EMPTY);
+    o_ptr->ident |= (IDENT_KNOWN);
+}
+
+/*!
+ * @brief オブジェクトを*鑑定*済にする /
+ * The player is now aware of the effects of the given object.
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param o_ptr *鑑定*済にするオブジェクトの構造体参照ポインタ
+ * @return なし
+ */
+void object_aware(player_type *owner_ptr, object_type *o_ptr)
+{
+    k_info[o_ptr->k_idx].aware = TRUE;
+
+    bool mihanmei = !object_is_aware(o_ptr);
+    bool is_undefined = mihanmei && !(k_info[o_ptr->k_idx].gen_flags & TRG_INSTA_ART) && record_ident && !owner_ptr->is_dead
+        && ((o_ptr->tval >= TV_AMULET && o_ptr->tval <= TV_POTION) || (o_ptr->tval == TV_FOOD));
+    if (!is_undefined)
+        return;
+
+    object_type forge;
+    object_type *q_ptr;
+    GAME_TEXT o_name[MAX_NLEN];
+
+    q_ptr = &forge;
+    object_copy(q_ptr, o_ptr);
+
+    q_ptr->number = 1;
+    object_desc(owner_ptr, o_name, q_ptr, OD_NAME_ONLY);
+
+    exe_write_diary(owner_ptr, DIARY_FOUND, 0, o_name);
+}
+
+/*!
+ * @brief オブジェクトを試行済にする /
+ * Something has been "sampled"
+ * @param o_ptr 試行済にするオブジェクトの構造体参照ポインタ
+ * @return なし
+ */
+void object_tried(object_type *o_ptr) { k_info[o_ptr->k_idx].tried = TRUE; }
diff --git a/src/object/object-appraiser.h b/src/object/object-appraiser.h
new file mode 100644 (file)
index 0000000..c76c0f2
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "system/angband.h"
+
+void object_known(object_type *o_ptr);
+void object_aware(player_type *owner_ptr, object_type *o_ptr);
+void object_tried(object_type *o_ptr);
index 0da5b5b..12b073a 100644 (file)
@@ -24,6 +24,7 @@
 #include "object/artifact.h"
 #include "object/item-apply-magic.h"
 #include "object/item-feeling.h"
+#include "object/object-appraiser.h" // 暫定、相互参照している.
 #include "object/object-boost.h"
 #include "object/object-curse.h"
 #include "object/object-ego.h"
@@ -356,75 +357,6 @@ OBJECT_IDX get_obj_num(player_type *owner_ptr, DEPTH level, BIT_FLAGS mode)
 
 
 /*!
- * @brief オブジェクトを鑑定済にする /
- * Known is true when the "attributes" of an object are "known".
- * @param o_ptr 鑑定済にするオブジェクトの構造体参照ポインタ
- * @return なし
- * These include tohit, todam, toac, cost, and pval (charges).\n
- *\n
- * Note that "knowing" an object gives you everything that an "awareness"\n
- * gives you, and much more.  In fact, the player is always "aware" of any\n
- * item of which he has full "knowledge".\n
- *\n
- * But having full knowledge of, say, one "wand of wonder", does not, by\n
- * itself, give you knowledge, or even awareness, of other "wands of wonder".\n
- * It happens that most "identify" routines (including "buying from a shop")\n
- * will make the player "aware" of the object as well as fully "know" it.\n
- *\n
- * This routine also removes any inscriptions generated by "feelings".\n
- */
-void object_known(object_type *o_ptr)
-{
-       o_ptr->feeling = FEEL_NONE;
-       o_ptr->ident &= ~(IDENT_SENSE);
-       o_ptr->ident &= ~(IDENT_EMPTY);
-       o_ptr->ident |= (IDENT_KNOWN);
-}
-
-
-/*!
- * @brief オブジェクトを*鑑定*済にする /
- * The player is now aware of the effects of the given object.
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param o_ptr *鑑定*済にするオブジェクトの構造体参照ポインタ
- * @return なし
- */
-void object_aware(player_type *owner_ptr, object_type *o_ptr)
-{
-       k_info[o_ptr->k_idx].aware = TRUE;
-
-       bool mihanmei = !object_is_aware(o_ptr);
-       bool is_undefined = mihanmei && !(k_info[o_ptr->k_idx].gen_flags & TRG_INSTA_ART) && record_ident &&
-               !owner_ptr->is_dead && ((o_ptr->tval >= TV_AMULET && o_ptr->tval <= TV_POTION) || (o_ptr->tval == TV_FOOD));
-       if (!is_undefined) return;
-
-       object_type forge;
-       object_type *q_ptr;
-       GAME_TEXT o_name[MAX_NLEN];
-
-       q_ptr = &forge;
-       object_copy(q_ptr, o_ptr);
-
-       q_ptr->number = 1;
-       object_desc(owner_ptr, o_name, q_ptr, OD_NAME_ONLY);
-
-       exe_write_diary(owner_ptr, DIARY_FOUND, 0, o_name);
-}
-
-
-/*!
- * @brief オブジェクトを試行済にする /
- * Something has been "sampled"
- * @param o_ptr 試行済にするオブジェクトの構造体参照ポインタ
- * @return なし
- */
-void object_tried(object_type *o_ptr)
-{
-       k_info[o_ptr->k_idx].tried = TRUE;
-}
-
-
-/*!
 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item.  Method 1 (Heavy).
 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
 * @return 擬似鑑定結果のIDを返す。
index fb5c1ab..7f1a998 100644 (file)
@@ -14,9 +14,6 @@ void delete_object(player_type *owner_ptr, POSITION y, POSITION x);
 
 OBJECT_IDX o_pop(floor_type *floor_ptr);
 OBJECT_IDX get_obj_num(player_type *o_ptr, DEPTH level, BIT_FLAGS mode);
-void object_known(object_type *o_ptr);
-void object_aware(player_type *owner_ptr, object_type *o_ptr);
-void object_tried(object_type *o_ptr);
 
 byte value_check_aux1(object_type *o_ptr);
 byte value_check_aux2(object_type *o_ptr);
index 5e996ed..68bab08 100644 (file)
 #include "monster/monster.h"
 #include "mspell/monster-spell.h"
 #include "object/artifact.h"
+#include "object/object-appraiser.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-mark-types.h"
index 2535ffc..36e33ad 100644 (file)
@@ -7,16 +7,17 @@
  */
 
 #include "process-death.h"
-#include "world/world.h"
+#include "core/stuff-handler.h"
 #include "floor/floor-town.h"
 #include "inventory/player-inventory.h"
 #include "object/item-use-flags.h"
-#include "object/object2.h"
+#include "object/object-appraiser.h"
 #include "object/object-flavor.h"
+#include "object/object2.h"
 #include "store/store-util.h"
 #include "store/store.h"
 #include "term/gameterm.h"
-#include "core/stuff-handler.h"
+#include "world/world.h"
 
 #define GRAVE_LINE_WIDTH 31
 
index 4e451fe..9d315d2 100644 (file)
@@ -16,6 +16,7 @@
 #include "object/item-apply-magic.h"
 #include "object/item-feeling.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-boost.h"
 #include "object/object-ego.h"
 #include "object/object-flavor.h"
index ad8a650..d7e6c66 100644 (file)
@@ -42,6 +42,7 @@
 #include "object/artifact.h"
 #include "object/item-feeling.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-boost.h"
 #include "object/object-ego.h"
 #include "object/object-flavor.h"
index cc5b997..0a9b103 100644 (file)
@@ -7,6 +7,7 @@
 #include "store/store-util.h"
 #include "object/item-apply-magic.h"
 #include "object/item-feeling.h"
+#include "object/object-appraiser.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
 #include "object/object2.h"
index ffe42b1..f106c59 100644 (file)
@@ -43,6 +43,7 @@
 #include "mind/mind.h"
 #include "object/item-feeling.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
index 228212b..da4acf8 100644 (file)
@@ -35,6 +35,7 @@
 #include "object/artifact.h"
 #include "object/item-apply-magic.h"
 #include "object/item-use-flags.h"
+#include "object/object-appraiser.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"