OSDN Git Service

[Refactor] #38997 do_cmd_disarm_aux() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Tue, 23 Jul 2019 01:05:29 +0000 (10:05 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 23 Jul 2019 01:05:29 +0000 (10:05 +0900)
src/cmd-basic.c
src/cmd-basic.h
src/player-move.c

index c8f3fd1..126944d 100644 (file)
@@ -1466,7 +1466,7 @@ static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
  * </pre>
  */
 
-bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
+bool do_cmd_disarm_aux(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir)
 {
        grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
@@ -1481,14 +1481,14 @@ bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
        bool more = FALSE;
 
        /* Get the "disarm" factor */
-       int i = p_ptr->skill_dis;
+       int i = creature_ptr->skill_dis;
        int j;
 
-       take_turn(p_ptr, 100);
+       take_turn(creature_ptr, 100);
 
        /* Penalize some conditions */
-       if (p_ptr->blind || no_lite()) i = i / 10;
-       if (p_ptr->confused || p_ptr->image) i = i / 10;
+       if (creature_ptr->blind || no_lite()) i = i / 10;
+       if (creature_ptr->confused || creature_ptr->image) i = i / 10;
 
        /* Extract the difficulty */
        j = i - power;
@@ -1502,13 +1502,13 @@ bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
                msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
                
                /* Reward */
-               gain_exp(p_ptr, power);
+               gain_exp(creature_ptr, power);
 
                /* Remove the trap */
                cave_alter_feat(y, x, FF_DISARM);
 
                /* Move the player onto the trap */
-               move_player(p_ptr, dir, easy_disarm, FALSE);
+               move_player(creature_ptr, dir, easy_disarm, FALSE);
        }
 
        /* Failure -- Keep trying */
@@ -1528,7 +1528,7 @@ bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
        {
                msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
                /* Move the player onto the trap */
-               move_player(p_ptr, dir, easy_disarm, FALSE);
+               move_player(creature_ptr, dir, easy_disarm, FALSE);
        }
        return (more);
 }
@@ -1625,7 +1625,7 @@ void do_cmd_disarm(player_type *creature_ptr)
                /* Disarm trap */
                else
                {
-                       more = do_cmd_disarm_aux(y, x, dir);
+                       more = do_cmd_disarm_aux(creature_ptr, y, x, dir);
                }
        }
 
@@ -1897,7 +1897,7 @@ void do_cmd_alter(void)
                /* Disarm traps */
                else if (have_flag(f_ptr->flags, FF_DISARM))
                {
-                       more = do_cmd_disarm_aux(y, x, dir);
+                       more = do_cmd_disarm_aux(p_ptr, y, x, dir);
                }
 
                else
index 17678c9..b0354cc 100644 (file)
@@ -27,6 +27,6 @@ extern void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type);
 extern void exe_fire(INVENTORY_IDX item, object_type *j_ptr, SPELL_IDX snipe_type);
 extern bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken);
 extern bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x);
-extern bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir);
+extern bool do_cmd_disarm_aux(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir);
 
 extern void kamaenaoshi(INVENTORY_IDX item);
index 4932bc3..255ad9d 100644 (file)
@@ -1142,7 +1142,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
        {
                if (!trap_can_be_ignored(p_ptr, g_ptr->feat))
                {
-                       (void)do_cmd_disarm_aux(y, x, dir);
+                       (void)do_cmd_disarm_aux(creature_ptr, y, x, dir);
                        return;
                }
        }