OSDN Git Service

[Refactor] #40414 Separated racial-mindcrafter.c/h from spells2.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 4 Jun 2020 12:47:07 +0000 (21:47 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 4 Jun 2020 12:47:07 +0000 (21:47 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/mind/mind.c
src/mind/racial-mindcrafter.c [new file with mode: 0644]
src/mind/racial-mindcrafter.h [new file with mode: 0644]
src/spell/spells2.c
src/spell/spells2.h

index 04767fc..09d7c5f 100644 (file)
     <ClCompile Include="..\..\src\mind\racial-cavalry.c" />\r
     <ClCompile Include="..\..\src\mind\racial-draconian.c" />\r
     <ClCompile Include="..\..\src\mind\racial-force-trainer.c" />\r
+    <ClCompile Include="..\..\src\mind\racial-mindcrafter.c" />\r
     <ClCompile Include="..\..\src\mind\racial-mirror-master.c" />\r
     <ClCompile Include="..\..\src\mind\monk-attack.c" />\r
     <ClCompile Include="..\..\src\mind\racial-ninja.c" />\r
     <ClInclude Include="..\..\src\mind\racial-cavalry.h" />\r
     <ClInclude Include="..\..\src\mind\racial-draconian.h" />\r
     <ClInclude Include="..\..\src\mind\racial-force-trainer.h" />\r
+    <ClInclude Include="..\..\src\mind\racial-mindcrafter.h" />\r
     <ClInclude Include="..\..\src\mind\racial-mirror-master.h" />\r
     <ClInclude Include="..\..\src\mind\monk-attack.h" />\r
     <ClInclude Include="..\..\src\mind\racial-ninja.h" />\r
index ed93b5b..26ee9f2 100644 (file)
     <ClCompile Include="..\..\src\mind\racial-draconian.c">
       <Filter>mind</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\mind\racial-mindcrafter.c">
+      <Filter>mind</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\mind\racial-draconian.h">
       <Filter>mind</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\mind\racial-mindcrafter.h">
+      <Filter>mind</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 561804e..d1ef564 100644 (file)
@@ -249,6 +249,7 @@ hengband_SOURCES = \
        mind/racial-cavalry.c mind/racial-cavalry.h \
        mind/racial-draconian.c mind/racial-draconian.h \
        mind/racial-force-trainer.c mind/racial-force-trainer.h \
+       mind/racial-mindcrafter.c mind/racial-mindcrafter.h \
        mind/racial-mirror-master.c mind/racial-mirror-master.h \
        mind/racial-ninja.c mind/racial-ninja.h \
        mind/racial-samurai.c mind/racial-samurai.h \
index a47f2f6..c5d4818 100644 (file)
@@ -26,8 +26,9 @@
 #include "io/targeting.h"
 #include "main/sound-definitions-table.h"
 #include "mind/racial-force-trainer.h"
-#include "mind/racial-ninja.h"
+#include "mind/racial-mindcrafter.h"
 #include "mind/racial-mirror-master.h"
+#include "mind/racial-ninja.h"
 #include "monster/monster-status.h"
 #include "player/avatar.h"
 #include "player/player-class.h"
diff --git a/src/mind/racial-mindcrafter.c b/src/mind/racial-mindcrafter.c
new file mode 100644 (file)
index 0000000..a35882a
--- /dev/null
@@ -0,0 +1,92 @@
+#include "mind/racial-mindcrafter.h"
+#include "autopick/autopick.h"
+#include "inventory/player-inventory.h"
+#include "object-enchant/item-feeling.h"
+#include "object-enchant/special-object-flags.h"
+#include "object/item-use-flags.h"
+#include "object/object-flavor.h"
+#include "object/object-mark-types.h"
+#include "perception/object-perception.h"
+#include "perception/simple-perception.h"
+
+/*!
+ * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @note
+ * currently this function allows pseudo-id of any object,
+ * including silly ones like potions & scrolls, which always
+ * get '{average}'. This should be changed, either to stop such
+ * items from being pseudo-id'd, or to allow psychometry to
+ * detect whether the unidentified potion/scroll/etc is
+ * good (Cure Light Wounds, Restore Strength, etc) or
+ * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
+ */
+bool psychometry(player_type *caster_ptr)
+{
+    concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
+    concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
+    object_type *o_ptr;
+    OBJECT_IDX item;
+    o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+    if (!o_ptr)
+        return FALSE;
+
+    if (object_is_known(o_ptr)) {
+        msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
+        return TRUE;
+    }
+
+    item_feel_type feel = pseudo_value_check_heavy(o_ptr);
+    GAME_TEXT o_name[MAX_NLEN];
+    object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+
+    if (!feel) {
+        msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
+        return TRUE;
+    }
+
+#ifdef JP
+    msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
+#else
+    msg_format("You feel that the %s %s %s...", o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
+#endif
+
+    o_ptr->ident |= (IDENT_SENSE);
+    o_ptr->feeling = feel;
+    o_ptr->marked |= OM_TOUCHED;
+
+    caster_ptr->update |= (PU_COMBINE | PU_REORDER);
+    caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+
+    bool okay = FALSE;
+    switch (o_ptr->tval) {
+    case TV_SHOT:
+    case TV_ARROW:
+    case TV_BOLT:
+    case TV_BOW:
+    case TV_DIGGING:
+    case TV_HAFTED:
+    case TV_POLEARM:
+    case TV_SWORD:
+    case TV_BOOTS:
+    case TV_GLOVES:
+    case TV_HELM:
+    case TV_CROWN:
+    case TV_SHIELD:
+    case TV_CLOAK:
+    case TV_SOFT_ARMOR:
+    case TV_HARD_ARMOR:
+    case TV_DRAG_ARMOR:
+    case TV_CARD:
+    case TV_RING:
+    case TV_AMULET:
+    case TV_LITE:
+    case TV_FIGURINE:
+        okay = TRUE;
+        break;
+    }
+
+    autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
+    return TRUE;
+}
diff --git a/src/mind/racial-mindcrafter.h b/src/mind/racial-mindcrafter.h
new file mode 100644 (file)
index 0000000..4c6f2a3
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool psychometry(player_type *caster_ptr);
index fafb746..3e36f38 100644 (file)
@@ -1,6 +1,5 @@
 /*!
- * @file spells2.c
- * @brief 魔法効果の実装/ Spell code (part 2)
+ * @brief 魔法効果の実装/ Spell code
  * @date 2014/07/15
  * @author
  * <pre>
@@ -12,7 +11,6 @@
  */
 
 #include "spell/spells2.h"
-#include "autopick/autopick.h"
 #include "cmd-action/cmd-attack.h"
 #include "cmd-action/cmd-pet.h"
 #include "cmd-io/cmd-dump.h"
@@ -1771,92 +1769,6 @@ bool hit_and_away(player_type *caster_ptr)
 }
 
 
-/*!
-* @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
-* @param caster_ptr プレーヤーへの参照ポインタ
-* @return なし
-* @note
-* currently this function allows pseudo-id of any object,
-* including silly ones like potions & scrolls, which always
-* get '{average}'. This should be changed, either to stop such
-* items from being pseudo-id'd, or to allow psychometry to
-* detect whether the unidentified potion/scroll/etc is
-* good (Cure Light Wounds, Restore Strength, etc) or
-* bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
-*/
-bool psychometry(player_type *caster_ptr)
-{
-       concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
-       concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
-       object_type *o_ptr;
-       OBJECT_IDX item;
-       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
-       if (!o_ptr) return FALSE;
-
-       if (object_is_known(o_ptr))
-       {
-               msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
-               return TRUE;
-       }
-
-       item_feel_type feel = pseudo_value_check_heavy(o_ptr);
-       GAME_TEXT o_name[MAX_NLEN];
-       object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
-       if (!feel)
-       {
-               msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
-               return TRUE;
-       }
-
-#ifdef JP
-       msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
-#else
-       msg_format("You feel that the %s %s %s...",
-               o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
-#endif
-
-       o_ptr->ident |= (IDENT_SENSE);
-       o_ptr->feeling = feel;
-       o_ptr->marked |= OM_TOUCHED;
-
-       caster_ptr->update |= (PU_COMBINE | PU_REORDER);
-       caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
-       bool okay = FALSE;
-       switch (o_ptr->tval)
-       {
-       case TV_SHOT:
-       case TV_ARROW:
-       case TV_BOLT:
-       case TV_BOW:
-       case TV_DIGGING:
-       case TV_HAFTED:
-       case TV_POLEARM:
-       case TV_SWORD:
-       case TV_BOOTS:
-       case TV_GLOVES:
-       case TV_HELM:
-       case TV_CROWN:
-       case TV_SHIELD:
-       case TV_CLOAK:
-       case TV_SOFT_ARMOR:
-       case TV_HARD_ARMOR:
-       case TV_DRAG_ARMOR:
-       case TV_CARD:
-       case TV_RING:
-       case TV_AMULET:
-       case TV_LITE:
-       case TV_FIGURINE:
-               okay = TRUE;
-               break;
-       }
-
-       autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
-       return TRUE;
-}
-
-
 bool android_inside_weapon(player_type *creature_ptr)
 {
        DIRECTION dir;
index 618c588..d298481 100644 (file)
@@ -39,7 +39,6 @@ void cast_invoke_spirits(player_type* caster_ptr, DIRECTION dir);
 void cast_shuffle(player_type* caster_ptr);
 bool vampirism(player_type* caster_ptr);
 bool hit_and_away(player_type* caster_ptr);
-bool psychometry(player_type* caster_ptr);
 bool android_inside_weapon(player_type* creature_ptr);
 bool create_ration(player_type* crature_ptr);
 void hayagake(player_type* creature_ptr);