OSDN Git Service

[Refactor] #38997 fetch() に player_type * 引数を追加. / Add player_type * argument to...
authordeskull <deskull@users.sourceforge.jp>
Sun, 27 Oct 2019 07:03:28 +0000 (16:03 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 27 Oct 2019 07:03:28 +0000 (16:03 +0900)
src/cmd/cmd-activate.c
src/mind.c
src/mutation.c
src/realm-sorcery.c
src/realm-trump.c
src/spells.h
src/spells3.c

index a424c9d..dc5443a 100644 (file)
@@ -1572,7 +1572,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
-               fetch(dir, 500, TRUE);
+               fetch(user_ptr, dir, 500, TRUE);
                break;
        }
 
index fdc13a9..58a8f89 100644 (file)
@@ -1149,7 +1149,7 @@ static bool cast_mindcrafter_spell(int spell)
                /* Telekinesis */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               fetch(dir, plev * 15, FALSE);
+               fetch(p_ptr, dir, plev * 15, FALSE);
 
                break;
        case 11:
index cf936cb..33f325c 100644 (file)
@@ -2116,7 +2116,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power)
                case MUT1_TELEKINES:
                        if (!get_aim_dir(&dir)) return FALSE;
                        msg_print(_("集中している...", "You concentrate..."));
-                       fetch(dir, lvl * 10, TRUE);
+                       fetch(creature_ptr, dir, lvl * 10, TRUE);
                        break;
 
                case MUT1_VTELEPORT:
index cb5c492..2e0cd00 100644 (file)
@@ -462,7 +462,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mod
                        {
                                if (!get_aim_dir(&dir)) return NULL;
 
-                               fetch(dir, weight, FALSE);
+                               fetch(caster_ptr, dir, weight, FALSE);
                        }
                }
                break;
index eb1553d..0525a60 100644 (file)
@@ -176,7 +176,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                        {
                                if (!get_aim_dir(&dir)) return NULL;
 
-                               fetch(dir, weight, FALSE);
+                               fetch(caster_ptr, dir, weight, FALSE);
                        }
                }
                break;
index 2595671..b35e618 100644 (file)
@@ -296,7 +296,7 @@ extern bool free_level_recall(player_type *creature_ptr);
 extern bool reset_recall(void);
 extern bool apply_disenchant(BIT_FLAGS mode);
 extern void call_the_(void);
-extern void fetch(DIRECTION dir, WEIGHT wgt, bool require_los);
+extern void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los);
 extern void alter_reality(void);
 extern void identify_pack(void);
 extern int remove_curse(void);
index d8f2feb..6ac3921 100644 (file)
@@ -1239,7 +1239,7 @@ void call_the_(void)
  * @param require_los 射線の通りを要求するならばTRUE
  * @return なし
  */
-void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
+void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los)
 {
        POSITION ty, tx;
        OBJECT_IDX i;
@@ -1248,7 +1248,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
        GAME_TEXT o_name[MAX_NLEN];
 
        /* Check to see if an object is already there */
-       if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx)
+       if (caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx)
        {
                msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something."));
                return;
@@ -1260,13 +1260,13 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
                tx = target_col;
                ty = target_row;
 
-               if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE)
+               if (distance(caster_ptr->y, caster_ptr->x, ty, tx) > MAX_RANGE)
                {
                        msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!"));
                        return;
                }
 
-               g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx];
+               g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
 
                /* We need an item to fetch */
                if (!g_ptr->o_idx)
@@ -1290,7 +1290,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
                                msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
                                return;
                        }
-                       else if (!projectable(p_ptr->y, p_ptr->x, ty, tx))
+                       else if (!projectable(caster_ptr->y, caster_ptr->x, ty, tx))
                        {
                                msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location."));
                                return;
@@ -1299,21 +1299,21 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
        }
        else
        {
-               ty = p_ptr->y; 
-               tx = p_ptr->x;
+               ty = caster_ptr->y; 
+               tx = caster_ptr->x;
                do
                {
                        ty += ddy[dir];
                        tx += ddx[dir];
-                       g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx];
+                       g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
 
-                       if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) ||
+                       if ((distance(caster_ptr->y, caster_ptr->x, ty, tx) > MAX_RANGE) ||
                                !cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
                }
                while (!g_ptr->o_idx);
        }
 
-       o_ptr = &p_ptr->current_floor_ptr->o_list[g_ptr->o_idx];
+       o_ptr = &caster_ptr->current_floor_ptr->o_list[g_ptr->o_idx];
 
        if (o_ptr->weight > wgt)
        {
@@ -1324,17 +1324,17 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
 
        i = g_ptr->o_idx;
        g_ptr->o_idx = o_ptr->next_o_idx;
-       p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
+       caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx = i; /* 'move' it */
 
        o_ptr->next_o_idx = 0;
-       o_ptr->iy = p_ptr->y;
-       o_ptr->ix = p_ptr->x;
+       o_ptr->iy = caster_ptr->y;
+       o_ptr->ix = caster_ptr->x;
 
        object_desc(o_name, o_ptr, OD_NAME_ONLY);
        msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name);
 
-       note_spot(p_ptr->y, p_ptr->x);
-       p_ptr->redraw |= PR_MAP;
+       note_spot(caster_ptr->y, caster_ptr->x);
+       caster_ptr->redraw |= PR_MAP;
 }
 
 /*!