OSDN Git Service

[Refactor] #37353 ベースアイテム判定処理を objectkind-hook.c/h へ分離。
authorDeskull <deskull@users.sourceforge.jp>
Fri, 14 Dec 2018 15:26:14 +0000 (00:26 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Fri, 14 Dec 2018 15:26:14 +0000 (00:26 +0900)
Separate judgment base-item functions to objectkind-hook.c/h.

Hengband_vcs2017/Hengband/Hengband.vcxproj
src/Makefile.am
src/objectkind-hook.c [new file with mode: 0644]
src/objectkind-hook.h [new file with mode: 0644]
src/xtra2.c

index 7155a43..006ed9d 100644 (file)
     <ClCompile Include="..\..\src\monsterrace-hook.c" />\r
     <ClCompile Include="..\..\src\object-curse.c" />\r
     <ClCompile Include="..\..\src\object-hook.c" />\r
+    <ClCompile Include="..\..\src\objectkind-hook.c" />\r
     <ClCompile Include="..\..\src\player-damage.c" />\r
     <ClCompile Include="..\..\src\player-item.c" />\r
     <ClCompile Include="..\..\src\realm-craft.c" />\r
     <ClInclude Include="..\..\src\monsterrace-hook.h" />\r
     <ClInclude Include="..\..\src\object-curse.h" />\r
     <ClInclude Include="..\..\src\object-hook.h" />\r
+    <ClInclude Include="..\..\src\objectkind-hook.h" />\r
     <ClInclude Include="..\..\src\player-damage.h" />\r
     <ClInclude Include="..\..\src\player-item.h" />\r
     <ClInclude Include="..\..\src\readdib.h" />\r
index cb16806..f84e01d 100644 (file)
@@ -22,7 +22,8 @@ hengband_SOURCES = \
        monster-process.h monster-status.c monster-status.h monster1.c \
        monster2.c mspells1.c mspells2.c mspells3.c mspells4.c mutation.c \
        object-curse.c object-curse.h \
-       object-hook.c object-hook.h object1.c object2.c obj_kind.c \
+       object-hook.c object-hook.h object1.c object2.c \
+       objectkind-hook.c objectkind-hook.h obj_kind.c \
        player-damage.c player-damage.h \
        racial.c \
        realm-arcane.c \
diff --git a/src/objectkind-hook.c b/src/objectkind-hook.c
new file mode 100644 (file)
index 0000000..56ceef8
--- /dev/null
@@ -0,0 +1,148 @@
+#include "angband.h"
+#include "objectkind-hook.h"
+
+/*!
+ * @brief オブジェクトがクロークかどうかを判定する /
+ * Hack -- determine if a template is Cloak
+ * @param k_idx 判定したいオブジェクトのベースアイテムID
+ * @return オブジェクトがクロークならばTRUEを返す
+ */
+bool kind_is_cloak(KIND_OBJECT_IDX k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if (k_ptr->tval == TV_CLOAK)
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
+
+
+/*!
+ * @brief オブジェクトが竿状武器かどうかを判定する /
+ * Hack -- determine if a template is Polearm
+ * @param k_idx 判定したいオブジェクトのベースアイテムID
+ * @return オブジェクトが竿状武器ならばTRUEを返す
+ */
+bool kind_is_polearm(KIND_OBJECT_IDX k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if (k_ptr->tval == TV_POLEARM)
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
+
+
+/*!
+ * @brief オブジェクトが剣かどうかを判定する /
+ * Hack -- determine if a template is Sword
+ * @param k_idx 判定したいオブジェクトのベースアイテムID
+ * @return オブジェクトが剣ならばTRUEを返す
+ */
+bool kind_is_sword(KIND_OBJECT_IDX k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if ((k_ptr->tval == TV_SWORD) && (k_ptr->sval > 2))
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
+
+
+/*!
+ * @brief オブジェクトが魔法書かどうかを判定する /
+ * Hack -- determine if a template is Book
+ * @param k_idx 判定したいオブジェクトのベースアイテムID
+ * @return オブジェクトが魔法書ならばTRUEを返す
+ */
+bool kind_is_book(KIND_OBJECT_IDX k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK))
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
+
+
+/*!
+ * @brief オブジェクトがベースアイテム時点でGOODかどうかを判定する /
+ * Hack -- determine if a template is Good book
+ * @param k_idx 判定したいオブジェクトのベースアイテムID
+ * @return オブジェクトがベースアイテム時点でGOODなアイテムならばTRUEを返す
+ */
+bool kind_is_good_book(KIND_OBJECT_IDX k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
+
+
+/*!
+ * @brief オブジェクトが鎧かどうかを判定する /
+ * Hack -- determine if a template is Armor
+ * @param k_idx 判定したいオブジェクトのベースアイテムID
+ * @return オブジェクトが鎧ならばTRUEを返す
+ */
+bool kind_is_armor(KIND_OBJECT_IDX k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if (k_ptr->tval == TV_HARD_ARMOR)
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
+
+
+/*!
+ * @brief オブジェクトが打撃武器かどうかを判定する /
+ * Hack -- determine if a template is hafted weapon
+ * @param k_idx 判定したいオブジェクトのベースアイテムID
+ * @return オブジェクトが打撃武器ならばTRUEを返す
+ */
+bool kind_is_hafted(KIND_OBJECT_IDX k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if (k_ptr->tval == TV_HAFTED)
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
diff --git a/src/objectkind-hook.h b/src/objectkind-hook.h
new file mode 100644 (file)
index 0000000..4312482
--- /dev/null
@@ -0,0 +1,11 @@
+\r
+bool kind_is_cloak(KIND_OBJECT_IDX k_idx);\r
+bool kind_is_polearm(KIND_OBJECT_IDX k_idx);\r
+bool kind_is_sword(KIND_OBJECT_IDX k_idx);\r
+bool kind_is_book(KIND_OBJECT_IDX k_idx);\r
+bool kind_is_good_book(KIND_OBJECT_IDX k_idx);\r
+bool kind_is_armor(KIND_OBJECT_IDX k_idx);\r
+bool kind_is_hafted(KIND_OBJECT_IDX k_idx);\r
+\r
+\r
+\r
index 44dc004..d08b9f7 100644 (file)
@@ -15,6 +15,7 @@
 #include "cmd-pet.h"
 #include "object-curse.h"
 #include "monsterrace-hook.h"
+#include "objectkind-hook.h"
 
 #define REWARD_CHANCE 10
 
@@ -117,37 +118,22 @@ void check_experience(void)
                                        int n;
                                        char tmp[32];
 
-#ifdef JP
-                                       cnv_stat(p_ptr->stat_max[0], tmp);
-                                       prt(format("        a) 腕力 (現在値 %s)", tmp), 2, 14);
-                                       cnv_stat(p_ptr->stat_max[1], tmp);
-                                       prt(format("        b) 知能 (現在値 %s)", tmp), 3, 14);
-                                       cnv_stat(p_ptr->stat_max[2], tmp);
-                                       prt(format("        c) 賢さ (現在値 %s)", tmp), 4, 14);
-                                       cnv_stat(p_ptr->stat_max[3], tmp);
-                                       prt(format("        d) 器用 (現在値 %s)", tmp), 5, 14);
-                                       cnv_stat(p_ptr->stat_max[4], tmp);
-                                       prt(format("        e) 耐久 (現在値 %s)", tmp), 6, 14);
-                                       cnv_stat(p_ptr->stat_max[5], tmp);
-                                       prt(format("        f) 魅力 (現在値 %s)", tmp), 7, 14);
-                                       prt("", 8, 14);
-                                       prt("        どの能力値を上げますか?", 1, 14);
-#else
                                        cnv_stat(p_ptr->stat_max[0], tmp);
-                                       prt(format("        a) Str (cur %s)", tmp), 2, 14);
+                                       prt(format(_("        a) 腕力 (現在値 %s)", "        a) Str (cur %s)"), tmp), 2, 14);
                                        cnv_stat(p_ptr->stat_max[1], tmp);
-                                       prt(format("        b) Int (cur %s)", tmp), 3, 14);
+                                       prt(format(_("        b) 知能 (現在値 %s)", "        a) Int (cur %s)"), tmp), 3, 14);
                                        cnv_stat(p_ptr->stat_max[2], tmp);
-                                       prt(format("        c) Wis (cur %s)", tmp), 4, 14);
+                                       prt(format(_("        c) 賢さ (現在値 %s)", "        a) Wis (cur %s)"), tmp), 4, 14);
                                        cnv_stat(p_ptr->stat_max[3], tmp);
-                                       prt(format("        d) Dex (cur %s)", tmp), 5, 14);
+                                       prt(format(_("        d) 器用 (現在値 %s)", "        a) Dex (cur %s)"), tmp), 5, 14);
                                        cnv_stat(p_ptr->stat_max[4], tmp);
-                                       prt(format("        e) Con (cur %s)", tmp), 6, 14);
+                                       prt(format(_("        e) 耐久 (現在値 %s)", "        a) Con (cur %s)"), tmp), 6, 14);
                                        cnv_stat(p_ptr->stat_max[5], tmp);
-                                       prt(format("        f) Chr (cur %s)", tmp), 7, 14);
+                                       prt(format(_("        f) 魅力 (現在値 %s)", "        a) Chr (cur %s)"), tmp), 7, 14);
+
                                        prt("", 8, 14);
-                                       prt("        Which stat do you want to raise?", 1, 14);
-#endif
+                                       prt(_("        どの能力値を上げますか?", "        Which stat do you want to raise?"), 1, 14);
+
                                        while(1)
                                        {
                                                choice = inkey();
@@ -220,151 +206,6 @@ static int get_coin_type(MONRACE_IDX r_idx)
 }
 
 
-/*!
- * @brief オブジェクトがクロークかどうかを判定する /
- * Hack -- determine if a template is Cloak
- * @param k_idx 判定したいオブジェクトのベースアイテムID
- * @return オブジェクトがクロークならばTRUEを返す
- */
-static bool kind_is_cloak(KIND_OBJECT_IDX k_idx)
-{
-       object_kind *k_ptr = &k_info[k_idx];
-
-       /* Analyze the item type */
-       if (k_ptr->tval == TV_CLOAK)
-       {
-               return (TRUE);
-       }
-
-       /* Assume not good */
-       return (FALSE);
-}
-
-
-/*!
- * @brief オブジェクトが竿状武器かどうかを判定する /
- * Hack -- determine if a template is Polearm
- * @param k_idx 判定したいオブジェクトのベースアイテムID
- * @return オブジェクトが竿状武器ならばTRUEを返す
- */
-static bool kind_is_polearm(KIND_OBJECT_IDX k_idx)
-{
-       object_kind *k_ptr = &k_info[k_idx];
-
-       /* Analyze the item type */
-       if (k_ptr->tval == TV_POLEARM)
-       {
-               return (TRUE);
-       }
-
-       /* Assume not good */
-       return (FALSE);
-}
-
-
-/*!
- * @brief オブジェクトが剣かどうかを判定する /
- * Hack -- determine if a template is Sword
- * @param k_idx 判定したいオブジェクトのベースアイテムID
- * @return オブジェクトが剣ならばTRUEを返す
- */
-static bool kind_is_sword(KIND_OBJECT_IDX k_idx)
-{
-       object_kind *k_ptr = &k_info[k_idx];
-
-       /* Analyze the item type */
-       if ((k_ptr->tval == TV_SWORD) && (k_ptr->sval > 2))
-       {
-               return (TRUE);
-       }
-
-       /* Assume not good */
-       return (FALSE);
-}
-
-
-/*!
- * @brief オブジェクトが魔法書かどうかを判定する /
- * Hack -- determine if a template is Book
- * @param k_idx 判定したいオブジェクトのベースアイテムID
- * @return オブジェクトが魔法書ならばTRUEを返す
- */
-static bool kind_is_book(KIND_OBJECT_IDX k_idx)
-{
-       object_kind *k_ptr = &k_info[k_idx];
-
-       /* Analyze the item type */
-       if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK))
-       {
-               return (TRUE);
-       }
-
-       /* Assume not good */
-       return (FALSE);
-}
-
-
-/*!
- * @brief オブジェクトがベースアイテム時点でGOODかどうかを判定する /
- * Hack -- determine if a template is Good book
- * @param k_idx 判定したいオブジェクトのベースアイテムID
- * @return オブジェクトがベースアイテム時点でGOODなアイテムならばTRUEを返す
- */
-static bool kind_is_good_book(KIND_OBJECT_IDX k_idx)
-{
-       object_kind *k_ptr = &k_info[k_idx];
-
-       /* Analyze the item type */
-       if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
-       {
-               return (TRUE);
-       }
-
-       /* Assume not good */
-       return (FALSE);
-}
-
-
-/*!
- * @brief オブジェクトが鎧かどうかを判定する /
- * Hack -- determine if a template is Armor
- * @param k_idx 判定したいオブジェクトのベースアイテムID
- * @return オブジェクトが鎧ならばTRUEを返す
- */
-static bool kind_is_armor(KIND_OBJECT_IDX k_idx)
-{
-       object_kind *k_ptr = &k_info[k_idx];
-
-       /* Analyze the item type */
-       if (k_ptr->tval == TV_HARD_ARMOR)
-       {
-               return (TRUE);
-       }
-
-       /* Assume not good */
-       return (FALSE);
-}
-
-
-/*!
- * @brief オブジェクトが打撃武器かどうかを判定する /
- * Hack -- determine if a template is hafted weapon
- * @param k_idx 判定したいオブジェクトのベースアイテムID
- * @return オブジェクトが打撃武器ならばTRUEを返す
- */
-static bool kind_is_hafted(KIND_OBJECT_IDX k_idx)
-{
-       object_kind *k_ptr = &k_info[k_idx];
-
-       /* Analyze the item type */
-       if (k_ptr->tval == TV_HAFTED)
-       {
-               return (TRUE);
-       }
-
-       /* Assume not good */
-       return (FALSE);
-}
 
 /*!
  * @brief クエストを達成状態にする /