OSDN Git Service

[Refactor] #37353 item_tester_learn_spell() を object-hook.c へ移動。 / Move item_tester_l...
authorDeskull <deskull@users.sourceforge.jp>
Sat, 26 Jan 2019 07:25:14 +0000 (16:25 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Sat, 26 Jan 2019 07:25:14 +0000 (16:25 +0900)
src/cmd5.c
src/object-hook.c
src/object-hook.h

index faae948..2fcc844 100644 (file)
@@ -14,6 +14,7 @@
 #include "angband.h"
 #include "avatar.h"
 #include "player-status.h"
+#include "object-hook.h"
 
 /*!
  * @brief 領域魔法に応じて技能の名称を返す。
@@ -315,35 +316,6 @@ static int get_spell(SPELL_IDX *sn, concptr prompt, OBJECT_SUBTYPE_VALUE sval, b
 }
 
 /*!
- * @brief オブジェクトがプレイヤーが使用可能な魔道書かどうかを判定する
- * @param o_ptr 判定したいオブ会ジェクトの構造体参照ポインタ
- * @return 学習できる魔道書ならばTRUEを返す
- */
-static bool item_tester_learn_spell(object_type *o_ptr)
-{
-       s32b choices = realm_choices2[p_ptr->pclass];
-
-       if (p_ptr->pclass == CLASS_PRIEST)
-       {
-               if (is_good_realm(p_ptr->realm1))
-               {
-                       choices &= ~(CH_DEATH | CH_DAEMON);
-               }
-               else
-               {
-                       choices &= ~(CH_LIFE | CH_CRUSADE);
-               }
-       }
-
-       if ((o_ptr->tval < TV_LIFE_BOOK) || (o_ptr->tval > (TV_LIFE_BOOK + MAX_REALM - 1))) return (FALSE);
-       if ((o_ptr->tval == TV_MUSIC_BOOK) && (p_ptr->pclass == CLASS_BARD)) return (TRUE);
-       else if (!is_magic(tval2realm(o_ptr->tval))) return FALSE;
-       if ((REALM1_BOOK == o_ptr->tval) || (REALM2_BOOK == o_ptr->tval)) return (TRUE);
-       if (choices & (0x0001 << (tval2realm(o_ptr->tval) - 1))) return (TRUE);
-       return (FALSE);
-}
-
-/*!
  * @brief プレイヤーの職業が練気術師の時、領域魔法と練気術を切り換える処理のインターフェイス
  * @param browse_only 魔法と技能の閲覧を行うならばTRUE
  * @return 魔道書を一冊も持っていないならTRUEを返す
index cbf3490..8122eff 100644 (file)
@@ -434,3 +434,32 @@ bool item_tester_hook_recharge(object_type *o_ptr)
 
        return (FALSE);
 }
+
+/*!
+ * @brief オブジェクトがプレイヤーが使用可能な魔道書かどうかを判定する
+ * @param o_ptr 判定したいオブ会ジェクトの構造体参照ポインタ
+ * @return 学習できる魔道書ならばTRUEを返す
+ */
+bool item_tester_learn_spell(object_type *o_ptr)
+{
+       s32b choices = realm_choices2[p_ptr->pclass];
+
+       if (p_ptr->pclass == CLASS_PRIEST)
+       {
+               if (is_good_realm(p_ptr->realm1))
+               {
+                       choices &= ~(CH_DEATH | CH_DAEMON);
+               }
+               else
+               {
+                       choices &= ~(CH_LIFE | CH_CRUSADE);
+               }
+       }
+
+       if ((o_ptr->tval < TV_LIFE_BOOK) || (o_ptr->tval > (TV_LIFE_BOOK + MAX_REALM - 1))) return (FALSE);
+       if ((o_ptr->tval == TV_MUSIC_BOOK) && (p_ptr->pclass == CLASS_BARD)) return (TRUE);
+       else if (!is_magic(tval2realm(o_ptr->tval))) return FALSE;
+       if ((REALM1_BOOK == o_ptr->tval) || (REALM2_BOOK == o_ptr->tval)) return (TRUE);
+       if (choices & (0x0001 << (tval2realm(o_ptr->tval) - 1))) return (TRUE);
+       return (FALSE);
+}
index 1b9f402..dfcf7d9 100644 (file)
@@ -22,3 +22,5 @@ extern bool item_tester_hook_identify_weapon_armour(object_type *o_ptr);
 extern bool item_tester_hook_identify_fully(object_type *o_ptr);\r
 extern bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr);\r
 extern bool item_tester_hook_recharge(object_type *o_ptr);\r
+\r
+extern bool item_tester_learn_spell(object_type *o_ptr);\r