OSDN Git Service

[Refactor] #37353 mention_use(), describe_use() を player-inventory.c/h へ移動.
authordeskull <deskull@users.sourceforge.jp>
Wed, 19 Jun 2019 14:53:49 +0000 (23:53 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 19 Jun 2019 14:53:49 +0000 (23:53 +0900)
src/cmd-item.c
src/core.c
src/object.h
src/object1.c
src/player-inventory.c
src/player-inventory.h
src/spells3.c

index d20b720..f204f60 100644 (file)
@@ -48,6 +48,7 @@
 #include "snipe.h"
 #include "player-race.h"
 #include "view-mainwindow.h"
+#include "player-inventory.h"
 
 /*!
  * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
index b0507be..0ba4bc8 100644 (file)
@@ -77,6 +77,7 @@
 #include "floor-save.h"
 #include "feature.h"
 #include "player-skill.h"
+#include "player-inventory.h"
 
 #include "view-mainwindow.h"
 #include "dungeon-file.h"
index 13f01ff..18c23f0 100644 (file)
@@ -411,8 +411,7 @@ extern char index_to_label(int i);
 extern INVENTORY_IDX label_to_inven(int c);
 extern INVENTORY_IDX label_to_equip(int c);
 extern s16b wield_slot(object_type *o_ptr);
-extern concptr mention_use(int i);
-extern concptr describe_use(int i);
+
 extern bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval);
 extern bool item_tester_okay(object_type *o_ptr, OBJECT_TYPE_VALUE tval);
 extern void display_inven(OBJECT_TYPE_VALUE tval);
index 064b855..11e64b6 100644 (file)
@@ -1432,93 +1432,6 @@ s16b wield_slot(object_type *o_ptr)
 }
 
 /*!
- * @brief 所持/装備オブジェクトIDの部位表現を返す /
- * Return a string mentioning how a given item is carried
- * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
- * @return 部位表現の文字列ポインタ
- */
-concptr mention_use(int i)
-{
-       concptr p;
-
-       /* Examine the location */
-       switch (i)
-       {
-#ifdef JP
-               case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
-#else
-               case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
-#endif
-
-#ifdef JP
-               case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
-#else
-               case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
-#endif
-
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
-               case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
-               case INVEN_LEFT:  p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
-               case INVEN_NECK:  p = _("  首", "Around neck"); break;
-               case INVEN_LITE:  p = _(" 光源", "Light source"); break;
-               case INVEN_BODY:  p = _("  体", "On body"); break;
-               case INVEN_OUTER: p = _("体の上", "About body"); break;
-               case INVEN_HEAD:  p = _("  頭", "On head"); break;
-               case INVEN_HANDS: p = _("  手", "On hands"); break;
-               case INVEN_FEET:  p = _("  足", "On feet"); break;
-               default:          p = _("ザック", "In pack"); break;
-       }
-
-       /* Return the result */
-       return p;
-}
-
-
-/*!
- * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
- * Return a string describing how a given item is being worn.
- * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
- * @return 状態表現内容の文字列ポインタ
- * @details
- * Currently, only used for items in the equipment, not p_ptr->inventory_list.
- */
-concptr describe_use(int i)
-{
-       concptr p;
-
-       switch (i)
-       {
-#ifdef JP
-               case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
-#else
-               case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
-#endif
-
-#ifdef JP
-               case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
-#else
-               case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
-#endif
-
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
-               case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
-               case INVEN_LEFT:  p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
-               case INVEN_NECK:  p = _("首にかけている", "wearing around your neck"); break;
-               case INVEN_LITE:  p = _("光源にしている", "using to light the way"); break;
-               case INVEN_BODY:  p = _("体に着ている", "wearing on your body"); break;
-               case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
-               case INVEN_HEAD:  p = _("頭にかぶっている", "wearing on your head"); break;
-               case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
-               case INVEN_FEET:  p = _("足にはいている", "wearing on your feet"); break;
-               default:          p = _("ザックに入っている", "carrying in your pack"); break;
-       }
-
-       /* Return the result */
-       return p;
-}
-
-
-/*!
  * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
  * Hack: Check if a spellbook is one of the realms we can use. -- TY
  * @param book_tval ベースアイテムのtval
index a2782b1..e77abac 100644 (file)
@@ -1,6 +1,8 @@
 #include "angband.h"
 #include "core.h"
 #include "util.h"
+#include "player-inventory.h"
+
 #include "term.h"
 #include "object.h"
 #include "objectkind.h"
@@ -3400,3 +3402,90 @@ COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
 
        return target_item_label;
 }
+
+/*!
+ * @brief 所持/装備オブジェクトIDの部位表現を返す /
+ * Return a string mentioning how a given item is carried
+ * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
+ * @return 部位表現の文字列ポインタ
+ */
+concptr mention_use(int i)
+{
+       concptr p;
+
+       /* Examine the location */
+       switch (i)
+       {
+#ifdef JP
+       case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
+#else
+       case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
+#endif
+
+#ifdef JP
+       case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
+#else
+       case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
+#endif
+
+       case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
+       case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
+       case INVEN_LEFT:  p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
+       case INVEN_NECK:  p = _("  首", "Around neck"); break;
+       case INVEN_LITE:  p = _(" 光源", "Light source"); break;
+       case INVEN_BODY:  p = _("  体", "On body"); break;
+       case INVEN_OUTER: p = _("体の上", "About body"); break;
+       case INVEN_HEAD:  p = _("  頭", "On head"); break;
+       case INVEN_HANDS: p = _("  手", "On hands"); break;
+       case INVEN_FEET:  p = _("  足", "On feet"); break;
+       default:          p = _("ザック", "In pack"); break;
+       }
+
+       /* Return the result */
+       return p;
+}
+
+
+/*!
+ * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
+ * Return a string describing how a given item is being worn.
+ * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
+ * @return 状態表現内容の文字列ポインタ
+ * @details
+ * Currently, only used for items in the equipment, not p_ptr->inventory_list.
+ */
+concptr describe_use(int i)
+{
+       concptr p;
+
+       switch (i)
+       {
+#ifdef JP
+       case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
+#else
+       case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
+#endif
+
+#ifdef JP
+       case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
+#else
+       case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
+#endif
+
+       case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
+       case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
+       case INVEN_LEFT:  p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
+       case INVEN_NECK:  p = _("首にかけている", "wearing around your neck"); break;
+       case INVEN_LITE:  p = _("光源にしている", "using to light the way"); break;
+       case INVEN_BODY:  p = _("体に着ている", "wearing on your body"); break;
+       case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
+       case INVEN_HEAD:  p = _("頭にかぶっている", "wearing on your head"); break;
+       case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
+       case INVEN_FEET:  p = _("足にはいている", "wearing on your feet"); break;
+       default:          p = _("ザックに入っている", "carrying in your pack"); break;
+       }
+
+       /* Return the result */
+       return p;
+}
+
index 7ad3756..1023c3c 100644 (file)
@@ -4,3 +4,5 @@ extern bool select_ring_slot;
 
 extern bool is_ring_slot(int i);
 extern bool get_item_okay(OBJECT_IDX i);
+extern concptr mention_use(int i);
+extern concptr describe_use(int i);
\ No newline at end of file
index 8903dec..40aef9f 100644 (file)
@@ -31,6 +31,7 @@
 #include "player-status.h"
 #include "player-class.h"
 #include "player-damage.h"
+#include "player-inventory.h"
 #include "spells-summon.h"
 #include "quest.h"
 #include "artifact.h"
@@ -1651,7 +1652,7 @@ bool artifact_scroll(void)
                                floor_item_increase(0 - item, 1 - (o_ptr->number));
                        }
                }
-               okay = create_artifact(o_ptr, TRUE);
+               okay = become_random_artifact(o_ptr, TRUE);
        }
 
        /* Failure */