OSDN Git Service

[Refactor] #37353 Separated hook-bow.c/h from object-hook.c/h
authorHourier <hourier@users.sourceforge.jp>
Sun, 28 Jun 2020 06:37:35 +0000 (15:37 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 28 Jun 2020 06:37:35 +0000 (15:37 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/autopick/autopick-entry.c
src/autopick/autopick-matcher.c
src/cmd-building/cmd-building.c
src/object-hook/hook-bow.c [new file with mode: 0644]
src/object-hook/hook-bow.h [new file with mode: 0644]
src/object/object-hook.c
src/object/object-hook.h
src/spell/spells-object.c

index 8f3a2f1..d63b9d9 100644 (file)
     <ClCompile Include="..\..\src\mind\mind-mage.c" />\r
     <ClCompile Include="..\..\src\mind\racial-kutar.c" />\r
     <ClCompile Include="..\..\src\mind\stances-table.c" />\r
+    <ClCompile Include="..\..\src\object-hook\hook-bow.c" />\r
     <ClCompile Include="..\..\src\object-hook\hook-perception.c" />\r
     <ClCompile Include="..\..\src\object-hook\hook-weapon.c" />\r
     <ClCompile Include="..\..\src\player\bad-status-setter.c" />\r
     <ClInclude Include="..\..\src\mspell\mspells1.h" />\r
     <ClInclude Include="..\..\src\mspell\mspells2.h" />\r
     <ClInclude Include="..\..\src\mspell\mspells3.h" />\r
+    <ClInclude Include="..\..\src\object-hook\hook-bow.h" />\r
     <ClInclude Include="..\..\src\object-hook\hook-perception.h" />\r
     <ClInclude Include="..\..\src\object-hook\hook-weapon.h" />\r
     <ClInclude Include="..\..\src\player\bad-status-setter.h" />\r
index 88665d8..a2d1ef4 100644 (file)
     <ClCompile Include="..\..\src\object-hook\hook-weapon.c">
       <Filter>object-hook</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\object-hook\hook-bow.c">
+      <Filter>object-hook</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\object-hook\hook-weapon.h">
       <Filter>object-hook</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\object-hook\hook-bow.h">
+      <Filter>object-hook</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 828e2d0..7e87285 100644 (file)
@@ -432,6 +432,7 @@ hengband_SOURCES = \
        object-enchant/trg-types.h \
        object-enchant/vorpal-weapon.c object-enchant/vorpal-weapon.h \
        \
+       object-hook/hook-bow.c object-hook/hook-bow.h \
        object-hook/hook-perception.c object-hook/hook-perception.h \
        object-hook/hook-weapon.c object-hook/hook-weapon.h \
        \
index ede5d01..ef668c1 100644 (file)
@@ -10,6 +10,7 @@
 #include "object-enchant/item-feeling.h"
 #include "object-enchant/object-ego.h"
 #include "object-enchant/special-object-flags.h"
+#include "object-hook/hook-bow.h"
 #include "object/item-use-flags.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
index 6944db7..a65ef3f 100644 (file)
@@ -13,6 +13,7 @@
 #include "perception/object-perception.h"
 #include "object/object-hook.h"
 #include "object-enchant/item-feeling.h"
+#include "object-hook/hook-bow.h"
 #include "object/object-kind.h"
 #include "object/object-stack.h"
 #include "object/object-value.h"
index 9014de6..11ae824 100644 (file)
@@ -46,6 +46,7 @@
 #include "market/poker.h"
 #include "monster-race/monster-race.h"
 #include "mutation/mutation.h"
+#include "object-hook/hook-bow.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "player/avatar.h"
diff --git a/src/object-hook/hook-bow.c b/src/object-hook/hook-bow.c
new file mode 100644 (file)
index 0000000..6d0047e
--- /dev/null
@@ -0,0 +1,55 @@
+#include "object-hook/hook-bow.h"
+#include "sv-definition/sv-other-types.h"
+#include "system/object-type-definition.h"
+
+/*!
+ * @brief 対象のアイテムが矢やクロスボウの矢の材料になるかを返す。/
+ * Hook to determine if an object is contertible in an arrow/bolt
+ * @param o_ptr オブジェクトの構造体の参照ポインタ。
+ * @return 材料にできるならTRUEを返す
+ */
+bool item_tester_hook_convertible(player_type *player_ptr, object_type *o_ptr)
+{
+    /* Unused */
+    (void)player_ptr;
+
+    if ((o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_SKELETON))
+        return TRUE;
+    if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON))
+        return TRUE;
+    return FALSE;
+}
+
+/*!
+ * @brief 武器匠の「矢弾」鑑定対象になるかを判定する。/ Hook to specify "weapon"
+ * @param o_ptr オブジェクトの構造体の参照ポインタ。
+ * @return 対象になるならTRUEを返す。
+ */
+bool item_tester_hook_ammo(player_type *player_ptr, object_type *o_ptr)
+{
+    /* Unused */
+    (void)player_ptr;
+
+    switch (o_ptr->tval) {
+    case TV_SHOT:
+    case TV_ARROW:
+    case TV_BOLT: {
+        return TRUE;
+    }
+    }
+
+    return FALSE;
+}
+
+/*!
+ * @brief オブジェクトが矢弾として使用できるかどうかを返す / Check if an object is ammo
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @return 矢弾として使えるならばTRUEを返す
+ */
+bool object_is_ammo(object_type *o_ptr)
+{
+    if (TV_MISSILE_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_MISSILE_END)
+        return TRUE;
+
+    return FALSE;
+}
diff --git a/src/object-hook/hook-bow.h b/src/object-hook/hook-bow.h
new file mode 100644 (file)
index 0000000..46e5ba3
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool item_tester_hook_convertible(player_type *player_ptr, object_type *o_ptr);
+bool item_tester_hook_ammo(player_type *player_ptr, object_type *o_ptr);
+bool object_is_ammo(object_type *o_ptr);
index 6812c7c..ba91577 100644 (file)
 bool (*item_tester_hook)(player_type *, object_type *);
 
 /*!
- * @brief 対象のアイテムが矢やクロスボウの矢の材料になるかを返す。/
- * Hook to determine if an object is contertible in an arrow/bolt
- * @param o_ptr オブジェクトの構造体の参照ポインタ。
- * @return 材料にできるならTRUEを返す
- */
-bool item_tester_hook_convertible(player_type *player_ptr, object_type *o_ptr)
-{
-    /* Unused */
-    (void)player_ptr;
-
-    if ((o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_SKELETON))
-        return TRUE;
-    if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON))
-        return TRUE;
-    return FALSE;
-}
-
-/*!
- * @brief 武器匠の「矢弾」鑑定対象になるかを判定する。/ Hook to specify "weapon"
- * @param o_ptr オブジェクトの構造体の参照ポインタ。
- * @return 対象になるならTRUEを返す。
- */
-bool item_tester_hook_ammo(player_type *player_ptr, object_type *o_ptr)
-{
-    /* Unused */
-    (void)player_ptr;
-
-    switch (o_ptr->tval) {
-    case TV_SHOT:
-    case TV_ARROW:
-    case TV_BOLT: {
-        return TRUE;
-    }
-    }
-
-    return FALSE;
-}
-
-/*!
  * @brief オブジェクトをプレイヤーが食べることができるかを判定する /
  * Hook to determine if an object is eatable
  * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
@@ -590,19 +551,6 @@ bool object_is_weapon_ammo(object_type *o_ptr)
 }
 
 /*!
- * @brief オブジェクトが矢弾として使用できるかどうかを返す / Check if an object is ammo
- * @param o_ptr 対象のオブジェクト構造体ポインタ
- * @return 矢弾として使えるならばTRUEを返す
- */
-bool object_is_ammo(object_type *o_ptr)
-{
-    if (TV_MISSILE_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_MISSILE_END)
-        return TRUE;
-
-    return FALSE;
-}
-
-/*!
  * @brief オブジェクトが防具として装備できるかどうかを返す / Check if an object is armour
  * @param o_ptr 対象のオブジェクト構造体ポインタ
  * @return 矢弾として使えるならばTRUEを返す
index 8b66bb2..d09d708 100644 (file)
@@ -5,9 +5,7 @@
 
 extern bool (*item_tester_hook)(player_type *, object_type *o_ptr);
 
-bool item_tester_hook_convertible(player_type *player_ptr, object_type *o_ptr);
 bool item_tester_hook_recharge(player_type *player_ptr, object_type *o_ptr);
-bool item_tester_hook_ammo(player_type *player_ptr, object_type *o_ptr);
 bool item_tester_hook_eatable(player_type *player_ptr, object_type *o_ptr);
 bool item_tester_hook_activate(player_type *player_ptr, object_type *o_ptr);
 bool item_tester_hook_wear(player_type *player_ptr, object_type *o_ptr);
@@ -28,7 +26,6 @@ bool object_is_favorite(player_type *player_ptr, object_type *o_ptr);
 bool object_is_rare(object_type *o_ptr);
 bool object_is_weapon(player_type *player_ptr, object_type *o_ptr);
 bool object_is_weapon_ammo(object_type *o_ptr);
-bool object_is_ammo(object_type *o_ptr);
 bool object_is_armour(player_type *player_ptr, object_type *o_ptr);
 bool object_is_weapon_armour_ammo(player_type *player_ptr, object_type *o_ptr);
 bool object_is_melee_weapon(object_type *o_ptr);
@@ -70,4 +67,4 @@ bool object_is_quest_target(player_type *player_ptr, object_type *o_ptr);
  */
 #define object_is_cursed(T) ((T)->curse_flags)
 
-extern bool item_tester_okay(player_type *player_ptr, object_type *o_ptr, tval_type tval);
+bool item_tester_okay(player_type *player_ptr, object_type *o_ptr, tval_type tval);
index 6a10775..0555df6 100644 (file)
@@ -29,6 +29,7 @@
 #include "object-enchant/tr-types.h"
 #include "object-enchant/trc-types.h"
 #include "object-enchant/trg-types.h"
+#include "object-hook/hook-bow.h"
 #include "object/item-use-flags.h"
 #include "object/object-flags.h"
 #include "object/object-flavor.h"