• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisione5a3f1607fba8c42252b507ce46b907b9053a890 (tree)
Time2019-06-19 23:53:49
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 mention_use(), describe_use() を player-inventory.c/h へ移動.

Change Summary

Incremental Difference

--- a/src/cmd-item.c
+++ b/src/cmd-item.c
@@ -48,6 +48,7 @@
4848 #include "snipe.h"
4949 #include "player-race.h"
5050 #include "view-mainwindow.h"
51+#include "player-inventory.h"
5152
5253 /*!
5354 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
--- a/src/core.c
+++ b/src/core.c
@@ -77,6 +77,7 @@
7777 #include "floor-save.h"
7878 #include "feature.h"
7979 #include "player-skill.h"
80+#include "player-inventory.h"
8081
8182 #include "view-mainwindow.h"
8283 #include "dungeon-file.h"
--- a/src/object.h
+++ b/src/object.h
@@ -411,8 +411,7 @@ extern char index_to_label(int i);
411411 extern INVENTORY_IDX label_to_inven(int c);
412412 extern INVENTORY_IDX label_to_equip(int c);
413413 extern s16b wield_slot(object_type *o_ptr);
414-extern concptr mention_use(int i);
415-extern concptr describe_use(int i);
414+
416415 extern bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval);
417416 extern bool item_tester_okay(object_type *o_ptr, OBJECT_TYPE_VALUE tval);
418417 extern void display_inven(OBJECT_TYPE_VALUE tval);
--- a/src/object1.c
+++ b/src/object1.c
@@ -1432,93 +1432,6 @@ s16b wield_slot(object_type *o_ptr)
14321432 }
14331433
14341434 /*!
1435- * @brief 所持/装備オブジェクトIDの部位表現を返す /
1436- * Return a string mentioning how a given item is carried
1437- * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1438- * @return 部位表現の文字列ポインタ
1439- */
1440-concptr mention_use(int i)
1441-{
1442- concptr p;
1443-
1444- /* Examine the location */
1445- switch (i)
1446- {
1447-#ifdef JP
1448- case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1449-#else
1450- case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1451-#endif
1452-
1453-#ifdef JP
1454- case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1455-#else
1456- case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1457-#endif
1458-
1459- case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1460- case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1461- case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1462- case INVEN_NECK: p = _(" 首", "Around neck"); break;
1463- case INVEN_LITE: p = _(" 光源", "Light source"); break;
1464- case INVEN_BODY: p = _(" 体", "On body"); break;
1465- case INVEN_OUTER: p = _("体の上", "About body"); break;
1466- case INVEN_HEAD: p = _(" 頭", "On head"); break;
1467- case INVEN_HANDS: p = _(" 手", "On hands"); break;
1468- case INVEN_FEET: p = _(" 足", "On feet"); break;
1469- default: p = _("ザック", "In pack"); break;
1470- }
1471-
1472- /* Return the result */
1473- return p;
1474-}
1475-
1476-
1477-/*!
1478- * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1479- * Return a string describing how a given item is being worn.
1480- * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1481- * @return 状態表現内容の文字列ポインタ
1482- * @details
1483- * Currently, only used for items in the equipment, not p_ptr->inventory_list.
1484- */
1485-concptr describe_use(int i)
1486-{
1487- concptr p;
1488-
1489- switch (i)
1490- {
1491-#ifdef JP
1492- case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1493-#else
1494- case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1495-#endif
1496-
1497-#ifdef JP
1498- case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1499-#else
1500- case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1501-#endif
1502-
1503- 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;
1504- case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1505- case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1506- case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1507- case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1508- case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1509- case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1510- case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1511- case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1512- case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1513- default: p = _("ザックに入っている", "carrying in your pack"); break;
1514- }
1515-
1516- /* Return the result */
1517- return p;
1518-}
1519-
1520-
1521-/*!
15221435 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
15231436 * Hack: Check if a spellbook is one of the realms we can use. -- TY
15241437 * @param book_tval ベースアイテムのtval
--- a/src/player-inventory.c
+++ b/src/player-inventory.c
@@ -1,6 +1,8 @@
11 #include "angband.h"
22 #include "core.h"
33 #include "util.h"
4+#include "player-inventory.h"
5+
46 #include "term.h"
57 #include "object.h"
68 #include "objectkind.h"
@@ -3400,3 +3402,90 @@ COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
34003402
34013403 return target_item_label;
34023404 }
3405+
3406+/*!
3407+ * @brief 所持/装備オブジェクトIDの部位表現を返す /
3408+ * Return a string mentioning how a given item is carried
3409+ * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
3410+ * @return 部位表現の文字列ポインタ
3411+ */
3412+concptr mention_use(int i)
3413+{
3414+ concptr p;
3415+
3416+ /* Examine the location */
3417+ switch (i)
3418+ {
3419+#ifdef JP
3420+ case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
3421+#else
3422+ case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
3423+#endif
3424+
3425+#ifdef JP
3426+ case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
3427+#else
3428+ case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
3429+#endif
3430+
3431+ case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
3432+ case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
3433+ case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
3434+ case INVEN_NECK: p = _(" 首", "Around neck"); break;
3435+ case INVEN_LITE: p = _(" 光源", "Light source"); break;
3436+ case INVEN_BODY: p = _(" 体", "On body"); break;
3437+ case INVEN_OUTER: p = _("体の上", "About body"); break;
3438+ case INVEN_HEAD: p = _(" 頭", "On head"); break;
3439+ case INVEN_HANDS: p = _(" 手", "On hands"); break;
3440+ case INVEN_FEET: p = _(" 足", "On feet"); break;
3441+ default: p = _("ザック", "In pack"); break;
3442+ }
3443+
3444+ /* Return the result */
3445+ return p;
3446+}
3447+
3448+
3449+/*!
3450+ * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
3451+ * Return a string describing how a given item is being worn.
3452+ * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
3453+ * @return 状態表現内容の文字列ポインタ
3454+ * @details
3455+ * Currently, only used for items in the equipment, not p_ptr->inventory_list.
3456+ */
3457+concptr describe_use(int i)
3458+{
3459+ concptr p;
3460+
3461+ switch (i)
3462+ {
3463+#ifdef JP
3464+ case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
3465+#else
3466+ case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
3467+#endif
3468+
3469+#ifdef JP
3470+ case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
3471+#else
3472+ case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
3473+#endif
3474+
3475+ 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;
3476+ case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
3477+ case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
3478+ case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
3479+ case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
3480+ case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
3481+ case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
3482+ case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
3483+ case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
3484+ case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
3485+ default: p = _("ザックに入っている", "carrying in your pack"); break;
3486+ }
3487+
3488+ /* Return the result */
3489+ return p;
3490+}
3491+
--- a/src/player-inventory.h
+++ b/src/player-inventory.h
@@ -4,3 +4,5 @@ extern bool select_ring_slot;
44
55 extern bool is_ring_slot(int i);
66 extern bool get_item_okay(OBJECT_IDX i);
7+extern concptr mention_use(int i);
8+extern concptr describe_use(int i);
\ No newline at end of file
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -31,6 +31,7 @@
3131 #include "player-status.h"
3232 #include "player-class.h"
3333 #include "player-damage.h"
34+#include "player-inventory.h"
3435 #include "spells-summon.h"
3536 #include "quest.h"
3637 #include "artifact.h"
@@ -1651,7 +1652,7 @@ bool artifact_scroll(void)
16511652 floor_item_increase(0 - item, 1 - (o_ptr->number));
16521653 }
16531654 }
1654- okay = create_artifact(o_ptr, TRUE);
1655+ okay = become_random_artifact(o_ptr, TRUE);
16551656 }
16561657
16571658 /* Failure */
Show on old repository browser