OSDN Git Service

[Refactor] #38997 CAN_TWO_HANDS_WIELDING() の関数マクロを普通の関数に変更し、player_type * 引数を追加 ...
[hengband/hengband.git] / src / cmd / cmd-item.c
index ca527dd..fe84895 100644 (file)
@@ -134,6 +134,7 @@ bool select_ring_slot = FALSE;
 
 /*!
  * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし 
  */
 void do_cmd_wield(player_type *creature_ptr)
@@ -265,7 +266,7 @@ void do_cmd_wield(player_type *creature_ptr)
        {
                object_desc(o_name, &creature_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
 #ifdef JP
-               msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
+               msg_format("%s%sは呪われているようだ。", describe_use(creature_ptr, slot) , o_name);
 #else
                msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
 #endif
@@ -317,14 +318,14 @@ void do_cmd_wield(player_type *creature_ptr)
                slot = need_switch_wielding;
        }
 
-       check_find_art_quest_completion(o_ptr);
+       check_find_art_quest_completion(creature_ptr, o_ptr);
 
        if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
        {
                identify_item(creature_ptr, o_ptr);
 
                /* Auto-inscription */
-               autopick_alter_item(item, FALSE);
+               autopick_alter_item(creature_ptr, item, FALSE);
        }
 
        take_turn(creature_ptr, 100);
@@ -345,8 +346,8 @@ void do_cmd_wield(player_type *creature_ptr)
        /* Decrease the item (from the floor) */
        else
        {
-               floor_item_increase(0 - item, -1);
-               floor_item_optimize(0 - item);
+               floor_item_increase(creature_ptr->current_floor_ptr, 0 - item, -1);
+               floor_item_optimize(creature_ptr->current_floor_ptr, 0 - item);
        }
 
        /* Access the wield slot */
@@ -377,14 +378,14 @@ void do_cmd_wield(player_type *creature_ptr)
        switch (slot)
        {
        case INVEN_RARM:
-               if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
+               if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) && can_two_hands_wielding(creature_ptr))
                        act = STR_WIELD_ARMS;
                else
                        act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
                break;
 
        case INVEN_LARM:
-               if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
+               if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) && can_two_hands_wielding(creature_ptr))
                        act = STR_WIELD_ARMS;
                else
                        act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
@@ -430,8 +431,10 @@ void do_cmd_wield(player_type *creature_ptr)
        calc_android_exp(creature_ptr);
 }
 
+
 /*!
  * @brief 持ち替え処理
+ * @param owner_ptr プレーヤーへの参照ポインタ
  * @param item 持ち替えを行いたい装備部位ID
  * @return なし
  */
@@ -449,7 +452,7 @@ void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item)
 
                if (object_is_cursed(o_ptr))
                {
-                       if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
+                       if (object_allow_two_hands_wielding(o_ptr) && can_two_hands_wielding(owner_ptr))
                                msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
                        return;
                }
@@ -459,7 +462,7 @@ void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item)
                owner_ptr->total_weight += o_ptr->weight;
                inven_item_increase(owner_ptr, INVEN_LARM, -((int)o_ptr->number));
                inven_item_optimize(owner_ptr, INVEN_LARM);
-               if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
+               if (object_allow_two_hands_wielding(o_ptr) && can_two_hands_wielding(owner_ptr))
                        msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
                else
                        msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
@@ -474,7 +477,7 @@ void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item)
 
        if (has_melee_weapon(owner_ptr, INVEN_RARM))
        {
-               if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
+               if (object_allow_two_hands_wielding(o_ptr) && can_two_hands_wielding(owner_ptr))
                        msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
                return;
        }
@@ -606,6 +609,7 @@ void do_cmd_drop(player_type *creature_ptr)
 
 /*!
  * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 void do_cmd_destroy(player_type *creature_ptr)
@@ -679,10 +683,10 @@ void do_cmd_destroy(player_type *creature_ptr)
                        if (i == 'A')
                        {
                                /* Add an auto-destroy preference line */
-                               if (autopick_autoregister(o_ptr))
+                               if (autopick_autoregister(creature_ptr, o_ptr))
                                {
                                        /* Auto-destroy it */
-                                       autopick_alter_item(item, TRUE);
+                                       autopick_alter_item(creature_ptr, item, TRUE);
                                }
 
                                /* The object is already destroyed. */
@@ -1119,7 +1123,7 @@ void do_cmd_locate(player_type *creature_ptr)
        x2 = x1 = panel_col_min;
 
        /* Show panels until done */
-       while (1)
+       while (TRUE)
        {
                /* Describe the location */
                if ((y2 == y1) && (x2 == x1))
@@ -1364,7 +1368,7 @@ void do_cmd_query_symbol(player_type *creature_ptr)
        i = n - 1;
 
        /* Scan the monster memory */
-       while (1)
+       while (TRUE)
        {
                r_idx = who[i];
 
@@ -1373,7 +1377,7 @@ void do_cmd_query_symbol(player_type *creature_ptr)
                handle_stuff(creature_ptr);
 
                /* Interact */
-               while (1)
+               while (TRUE)
                {
                        if (recall)
                        {