OSDN Git Service

[Refactor] #38997 wield_slot() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Sat, 4 Jan 2020 17:09:11 +0000 (02:09 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 4 Jan 2020 17:09:11 +0000 (02:09 +0900)
src/birth.c
src/cmd/cmd-item.c
src/object-hook.c
src/object.h
src/object1.c

index 241502b..22775c4 100644 (file)
@@ -1973,7 +1973,7 @@ static void wield_all(player_type *creature_ptr)
                if (!o_ptr->k_idx) continue; 
  
                /* Make sure we can wield it and that there's nothing else in that slot */ 
-               slot = wield_slot(o_ptr); 
+               slot = wield_slot(creature_ptr, o_ptr); 
                if (slot < INVEN_RARM) continue; 
                if (slot == INVEN_LITE) continue; /* Does not wield toaches because buys a lantern soon */
                if (creature_ptr->inventory_list[slot].k_idx) continue; 
index 574de6c..03b8f44 100644 (file)
@@ -166,7 +166,7 @@ void do_cmd_wield(player_type *creature_ptr)
        if (!o_ptr) return;
 
        /* Check the slot */
-       slot = wield_slot(o_ptr);
+       slot = wield_slot(creature_ptr, o_ptr);
 
        switch (o_ptr->tval)
        {
index ff43b39..29b9413 100644 (file)
@@ -197,7 +197,7 @@ bool item_tester_hook_wear(object_type *o_ptr)
                if (p_ptr->psex == SEX_MALE) return FALSE;
 
        /* Check for a usable slot */
-       if (wield_slot(o_ptr) >= INVEN_RARM) return (TRUE);
+       if (wield_slot(p_ptr, o_ptr) >= INVEN_RARM) return (TRUE);
 
        return (FALSE);
 }
index dc56cf9..6c3a282 100644 (file)
@@ -408,7 +408,7 @@ extern concptr item_activation(object_type *o_ptr);
 extern bool screen_object(object_type *o_ptr, BIT_FLAGS mode);
 
 extern char index_to_label(int i);
-extern s16b wield_slot(object_type *o_ptr);
+extern s16b wield_slot(player_type *owner_ptr, object_type *o_ptr);
 
 extern bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval);
 
index e757972..65d3e0f 100644 (file)
@@ -1324,7 +1324,7 @@ char index_to_label(int i)
  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
  * @return 対応する装備部位ID
  */
-s16b wield_slot(object_type *o_ptr)
+s16b wield_slot(player_type *owner_ptr, object_type *o_ptr)
 {
        /* Slot for equipment */
        switch (o_ptr->tval)
@@ -1334,8 +1334,8 @@ s16b wield_slot(object_type *o_ptr)
                case TV_POLEARM:
                case TV_SWORD:
                {
-                       if (!p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
-                       if (p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
+                       if (!owner_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
+                       if (owner_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
                        return (INVEN_LARM);
                }
 
@@ -1343,8 +1343,8 @@ s16b wield_slot(object_type *o_ptr)
                case TV_CARD:
                case TV_SHIELD:
                {
-                       if (!p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
-                       if (p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
+                       if (!owner_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
+                       if (owner_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
                        return (INVEN_RARM);
                }
 
@@ -1356,7 +1356,7 @@ s16b wield_slot(object_type *o_ptr)
                case TV_RING:
                {
                        /* Use the right hand first */
-                       if (!p_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
+                       if (!owner_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
 
                        /* Use the left hand for swapping (by default) */
                        return (INVEN_LEFT);