OSDN Git Service

[Refactor] #39068 choose_object() の item_tester_tval グローバル参照をローカル引数に収める.(一部バグを起こしている可...
[hengband/hengband.git] / src / cmd-zapwand.c
index 73811e8..01cf109 100644 (file)
@@ -1,8 +1,18 @@
 #include "angband.h"
+#include "util.h"
+
 #include "avatar.h"
+#include "spells.h"
 #include "spells-status.h"
 #include "player-status.h"
-
+#include "player-effects.h"
+#include "player-class.h"
+#include "objectkind.h"
+#include "object-hook.h"
+#include "cmd-basic.h"
+#include "floor.h"
+#include "targeting.h"
+#include "view-mainwindow.h"
 
 /*!
 * @brief 魔法棒の効果を発動する
@@ -306,7 +316,7 @@ bool wand_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool powerful, bool m
 * Handle "unstacking" in a logical manner.
 * For simplicity, you cannot use a stack of items from the
 * ground.  This would require too much nasty code.
-* There are no wands which can "destroy" themselves, in the inventory
+* There are no wands which can "destroy" themselves, in the p_ptr->inventory_list
 * or on the ground, so we can ignore this possibility.  Note that this
 * required giving "wand of wonder" the ability to ignore destruction
 * by electric balls.
@@ -327,13 +337,13 @@ void do_cmd_aim_wand_aux(INVENTORY_IDX item)
        /* Get the item (in the pack) */
        if (item >= 0)
        {
-               o_ptr = &inventory[item];
+               o_ptr = &p_ptr->inventory_list[item];
        }
 
        /* Get the item (on the floor) */
        else
        {
-               o_ptr = &o_list[0 - item];
+               o_ptr = &current_floor_ptr->o_list[0 - item];
        }
 
        /* Mega-Hack -- refuse to aim a pile from the ground */
@@ -355,7 +365,7 @@ void do_cmd_aim_wand_aux(INVENTORY_IDX item)
        }
        target_pet = old_target_pet;
 
-       take_turn(p_ptr, 100);;
+       take_turn(p_ptr, 100);
 
        /* Get the level */
        lev = k_info[o_ptr->k_idx].level;
@@ -451,10 +461,6 @@ void do_cmd_aim_wand(void)
 
        if (p_ptr->wild_mode) return;
        if (cmd_limit_arena(p_ptr)) return;
-
-       /* Restrict choices to wands */
-       item_tester_tval = TV_WAND;
-
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
        {
                set_action(ACTION_NONE);
@@ -462,7 +468,7 @@ void do_cmd_aim_wand(void)
 
        q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
        s = _("使える魔法棒がない。", "You have no wand to aim.");
-       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), TV_WAND)) return;
 
        do_cmd_aim_wand_aux(item);
 }