OSDN Git Service

[Refactor] #40399 Separated torch.c/h from object2.h
authorHourier <hourier@users.sourceforge.jp>
Fri, 29 May 2020 14:08:46 +0000 (23:08 +0900)
committerHourier <hourier@users.sourceforge.jp>
Fri, 29 May 2020 14:08:46 +0000 (23:08 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd/cmd-basic.c
src/combat/slaying.c
src/object/object2.c
src/object/object2.h
src/object/torch.c [new file with mode: 0644]
src/object/torch.h [new file with mode: 0644]

index cbc7ddb..1ae4c5b 100644 (file)
     <ClCompile Include="..\..\src\autopick\autopick-util.c" />\r
     <ClCompile Include="..\..\src\autopick\autopick.c" />\r
     <ClCompile Include="..\..\src\object\death-scythe.c" />\r
+    <ClCompile Include="..\..\src\object\torch.c" />\r
     <ClCompile Include="..\..\src\player\avatar.c" />\r
     <ClCompile Include="..\..\src\birth\character-builder.c" />\r
     <ClCompile Include="..\..\src\birth\birth-explanations-table.c" />\r
     <ClInclude Include="..\..\src\object\sv-staff-types.h" />\r
     <ClInclude Include="..\..\src\object\sv-wand-types.h" />\r
     <ClInclude Include="..\..\src\object\sv-weapon-types.h" />\r
+    <ClInclude Include="..\..\src\object\torch.h" />\r
     <ClInclude Include="..\..\src\object\tr-types.h" />\r
     <ClInclude Include="..\..\src\object\trc-types.h" />\r
     <ClInclude Include="..\..\src\object\tval-types.h" />\r
index 02e2e27..da6d64b 100644 (file)
     <ClCompile Include="..\..\src\util\util.c">
       <Filter>util</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\object\torch.c">
+      <Filter>object</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-activate.h">
     <ClInclude Include="..\..\src\object\object2.h">
       <Filter>object</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\object\torch.h">
+      <Filter>object</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index e293b01..3fd8afe 100644 (file)
@@ -215,6 +215,7 @@ hengband_SOURCES = \
        object/sv-rod-types.h object/sv-scroll-types.h \
        object/sv-staff-types.h object/sv-wand-types.h object/sv-other-types.h \
        object/item-feeling.h object/item-use-flags.h \
+       object/torch.c object/torch.h \
        \
        inventory/simple-appraiser.c inventory/simple-appraiser.h \
        inventory/inventory-curse.c inventory/inventory-curse.h \
index d82a82a..97b8492 100644 (file)
@@ -30,6 +30,7 @@
 #include "dungeon/quest.h"
 #include "object/artifact.h"
 #include "object/object2.h"
+#include "object/torch.h"
 #include "player/avatar.h"
 #include "player/player-status.h"
 #include "realm/realm-hex.h"
index 4f30a08..5f32656 100644 (file)
@@ -4,6 +4,7 @@
 #include "realm/realm-hex.h"
 #include "mind/samurai-slaying.h"
 #include "object/object2.h"
+#include "object/torch.h"
 #include "object/tr-types.h"
 
 /*!
index ef5f528..2056212 100644 (file)
@@ -53,7 +53,6 @@
 #include "monster/monster-race-hook.h"
 #include "object/object-ego.h"
 #include "view/display-main-window.h"
-#include "object/tr-types.h"
 #include "object/trc-types.h"
 
 #define MAX_GOLD 18 /* Number of "gold" entries */
@@ -4376,54 +4375,6 @@ void display_koff(player_type *owner_ptr, KIND_OBJECT_IDX k_idx)
 
 
 /*!
- * @brief 投擲時たいまつに投げやすい/焼棄/アンデッドスレイの特別効果を返す。
- * Torches have special abilities when they are flaming.
- * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ
- * @param flgs 特別に追加するフラグを返す参照ポインタ
- * @return なし
- */
-void torch_flags(object_type *o_ptr, BIT_FLAGS *flgs)
-{
-       if ((o_ptr->tval != TV_LITE) || (o_ptr->sval != SV_LITE_TORCH)) return;
-       if (o_ptr->xtra4 <= 0) return;
-       add_flag(flgs, TR_BRAND_FIRE);
-       add_flag(flgs, TR_KILL_UNDEAD);
-       add_flag(flgs, TR_THROW);
-}
-
-
-/*!
- * @brief 投擲時たいまつにダイスを与える。
- * Torches have special abilities when they are flaming.
- * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ
- * @param dd 特別なダイス数を返す参照ポインタ
- * @param ds 特別なダイス面数を返す参照ポインタ
- * @return なし
- */
-void torch_dice(object_type *o_ptr, DICE_NUMBER *dd, DICE_SID *ds)
-{
-       if ((o_ptr->tval != TV_LITE) || (o_ptr->sval != SV_LITE_TORCH)) return;
-       if (o_ptr->xtra4 <= 0) return;
-       (*dd) = 1;
-       (*ds) = 6;
-}
-
-
-/*!
- * @brief 投擲時命中したたいまつの寿命を縮める。
- * Torches have special abilities when they are flaming.
- * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ
- * @return なし
- */
-void torch_lost_fuel(object_type *o_ptr)
-{
-       if ((o_ptr->tval != TV_LITE) || (o_ptr->sval != SV_LITE_TORCH)) return;
-       o_ptr->xtra4 -= (FUEL_TORCH / 25);
-       if (o_ptr->xtra4 < 0) o_ptr->xtra4 = 0;
-}
-
-
-/*!
  * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す /
  * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
  * @return 対応する矢/弾薬のベースアイテムID
index 7439364..dfa1544 100644 (file)
@@ -53,6 +53,3 @@ void drop_from_inventory(player_type *owner_type, INVENTORY_IDX item, ITEM_NUMBE
 void combine_pack(player_type *owner_ptr);
 void reorder_pack(player_type *owner_ptr);
 void display_koff(player_type *owner_ptr, KIND_OBJECT_IDX k_idx);
-void torch_flags(object_type *o_ptr, BIT_FLAGS *flgs);
-void torch_dice(object_type *o_ptr, DICE_NUMBER *dd, DICE_SID *ds);
-void torch_lost_fuel(object_type *o_ptr);
diff --git a/src/object/torch.c b/src/object/torch.c
new file mode 100644 (file)
index 0000000..9fe7a1f
--- /dev/null
@@ -0,0 +1,54 @@
+#include "object/torch.h"
+#include "object/sv-lite-types.h"
+#include "object/tr-types.h"
+
+/*!
+ * @brief 投擲時たいまつに投げやすい/焼棄/アンデッドスレイの特別効果を返す。
+ * Torches have special abilities when they are flaming.
+ * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ
+ * @param flgs 特別に追加するフラグを返す参照ポインタ
+ * @return なし
+ */
+void torch_flags(object_type *o_ptr, BIT_FLAGS *flgs)
+{
+    if ((o_ptr->tval != TV_LITE) || (o_ptr->sval != SV_LITE_TORCH))
+        return;
+    if (o_ptr->xtra4 <= 0)
+        return;
+    add_flag(flgs, TR_BRAND_FIRE);
+    add_flag(flgs, TR_KILL_UNDEAD);
+    add_flag(flgs, TR_THROW);
+}
+
+/*!
+ * @brief 投擲時たいまつにダイスを与える。
+ * Torches have special abilities when they are flaming.
+ * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ
+ * @param dd 特別なダイス数を返す参照ポインタ
+ * @param ds 特別なダイス面数を返す参照ポインタ
+ * @return なし
+ */
+void torch_dice(object_type *o_ptr, DICE_NUMBER *dd, DICE_SID *ds)
+{
+    if ((o_ptr->tval != TV_LITE) || (o_ptr->sval != SV_LITE_TORCH))
+        return;
+    if (o_ptr->xtra4 <= 0)
+        return;
+    (*dd) = 1;
+    (*ds) = 6;
+}
+
+/*!
+ * @brief 投擲時命中したたいまつの寿命を縮める。
+ * Torches have special abilities when they are flaming.
+ * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ
+ * @return なし
+ */
+void torch_lost_fuel(object_type *o_ptr)
+{
+    if ((o_ptr->tval != TV_LITE) || (o_ptr->sval != SV_LITE_TORCH))
+        return;
+    o_ptr->xtra4 -= (FUEL_TORCH / 25);
+    if (o_ptr->xtra4 < 0)
+        o_ptr->xtra4 = 0;
+}
diff --git a/src/object/torch.h b/src/object/torch.h
new file mode 100644 (file)
index 0000000..a448bc8
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once
+
+#include "system/angband.h"
+#include "object/object-util.h"
+
+void torch_flags(object_type *o_ptr, BIT_FLAGS *flgs);
+void torch_dice(object_type *o_ptr, DICE_NUMBER *dd, DICE_SID *ds);
+void torch_lost_fuel(object_type *o_ptr);