OSDN Git Service

[Refactor] #38997 tgt_pt() に player_type * 引数を追加. / Add player_type * argument to...
authordeskull <deskull@users.sourceforge.jp>
Sat, 4 Jan 2020 07:56:31 +0000 (16:56 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 4 Jan 2020 07:56:31 +0000 (16:56 +0900)
src/player-move.c
src/realm-hex.c
src/realm-hissatsu.c
src/spells3.c
src/targeting.c
src/targeting.h
src/wizard1.c
src/wizard2.c

index fed968c..7335d8c 100644 (file)
@@ -2225,7 +2225,7 @@ void do_cmd_travel(player_type *creature_ptr)
                y = travel.y;
                x = travel.x;
        }
-       else if (!tgt_pt(&x, &y)) return;
+       else if (!tgt_pt(creature_ptr, &x, &y)) return;
 
        if ((x == creature_ptr->x) && (y == creature_ptr->y))
        {
index 47e1355..d279d2c 100644 (file)
@@ -1014,7 +1014,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
 
                        for (i = 0; i < 3; i++)
                        {
-                               if (!tgt_pt(&x, &y)) return FALSE;
+                               if (!tgt_pt(caster_ptr, &x, &y)) return FALSE;
 
                                flag = FALSE;
 
index 40f7381..37a8c9e 100644 (file)
@@ -797,7 +797,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!tgt_pt(&x, &y)) return NULL;
+                       if (!tgt_pt(caster_ptr, &x, &y)) return NULL;
 
                        if (!cave_player_teleportable_bold(y, x, 0L) ||
                                (distance(y, x, caster_ptr->y, caster_ptr->x) > MAX_SIGHT / 2) ||
index 9131483..2d2a9da 100644 (file)
@@ -2941,7 +2941,7 @@ bool dimension_door(void)
        DEPTH x = 0, y = 0;
 
        /* Rerutn FALSE if cancelled */
-       if (!tgt_pt(&x, &y)) return FALSE;
+       if (!tgt_pt(p_ptr, &x, &y)) return FALSE;
 
        if (dimension_door_aux(p_ptr, x, y)) return TRUE;
 
@@ -2961,7 +2961,7 @@ bool mirror_tunnel(void)
        POSITION x = 0, y = 0;
 
        /* Rerutn FALSE if cancelled */
-       if (!tgt_pt(&x, &y)) return FALSE;
+       if (!tgt_pt(p_ptr, &x, &y)) return FALSE;
 
        if (dimension_door_aux(p_ptr, x, y)) return TRUE;
 
index fb7cf3c..ba8a566 100644 (file)
@@ -1996,7 +1996,7 @@ static void tgt_pt_prepare(void)
 /*
  * old -- from PsiAngband.
  */
-bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
+bool tgt_pt(player_type *creature_ptr, POSITION *x_ptr, POSITION *y_ptr)
 {
        char ch = 0;
        int d, n = 0;
@@ -2007,8 +2007,8 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
 
        get_screen_size(&wid, &hgt);
 
-       x = p_ptr->x;
-       y = p_ptr->y;
+       x = creature_ptr->x;
+       y = creature_ptr->y;
 
        if (expand_list) 
        {
@@ -2034,7 +2034,7 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                case '5':
                case '0':
                        /* illegal place */
-                       if (player_bold(p_ptr, y, x)) ch = 0;
+                       if (player_bold(creature_ptr, y, x)) ch = 0;
 
                        /* okay place */
                        else success = TRUE;
@@ -2055,7 +2055,7 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                                /* Skip stairs which have defferent distance */
                                for (; n < tmp_pos.n; ++ n)
                                {
-                                       grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[tmp_pos.y[n]][tmp_pos.x[n]];
+                                       grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[tmp_pos.y[n]][tmp_pos.x[n]];
 
                                        if (cave_have_flag_grid(g_ptr, FF_STAIRS) &&
                                            cave_have_flag_grid(g_ptr, ch == '>' ? FF_MORE : FF_LESS))
@@ -2068,15 +2068,15 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                                if (n == tmp_pos.n)     /* Loop out taget list */
                                {
                                        n = 0;
-                                       y = p_ptr->y;
-                                       x = p_ptr->x;
+                                       y = creature_ptr->y;
+                                       x = creature_ptr->x;
                                        verify_panel(); /* Move cursor to player */
 
-                                       p_ptr->update |= (PU_MONSTERS);
+                                       creature_ptr->update |= (PU_MONSTERS);
 
-                                       p_ptr->redraw |= (PR_MAP);
+                                       creature_ptr->redraw |= (PR_MAP);
 
-                                       p_ptr->window |= (PW_OVERHEAD);
+                                       creature_ptr->window |= (PW_OVERHEAD);
                                        handle_stuff();
                                }
                                else    /* move cursor to next stair and change panel */
@@ -2140,11 +2140,11 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                                }
 
                                /* Slide into legality */
-                               if (x >= p_ptr->current_floor_ptr->width-1) x = p_ptr->current_floor_ptr->width - 2;
+                               if (x >= creature_ptr->current_floor_ptr->width-1) x = creature_ptr->current_floor_ptr->width - 2;
                                else if (x <= 0) x = 1;
 
                                /* Slide into legality */
-                               if (y >= p_ptr->current_floor_ptr->height-1) y = p_ptr->current_floor_ptr->height- 2;
+                               if (y >= creature_ptr->current_floor_ptr->height-1) y = creature_ptr->current_floor_ptr->height- 2;
                                else if (y <= 0) y = 1;
 
                        }
@@ -2158,11 +2158,11 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
        /* Recenter the map around the player */
        verify_panel();
 
-       p_ptr->update |= (PU_MONSTERS);
+       creature_ptr->update |= (PU_MONSTERS);
 
-       p_ptr->redraw |= (PR_MAP);
+       creature_ptr->redraw |= (PR_MAP);
 
-       p_ptr->window |= (PW_OVERHEAD);
+       creature_ptr->window |= (PW_OVERHEAD);
        handle_stuff();
 
        *x_ptr = x;
index 22b12c0..db16b74 100644 (file)
@@ -23,4 +23,4 @@ extern bool get_aim_dir(DIRECTION *dp);
 extern bool get_hack_dir(DIRECTION *dp);
 extern bool get_direction(player_type *creature_ptr, DIRECTION *dp, bool allow_under, bool with_steed);
 extern bool get_rep_dir(DIRECTION *dp, bool under);
-extern bool tgt_pt(POSITION *x, POSITION *y);
+extern bool tgt_pt(player_type *creature_ptr, POSITION *x, POSITION *y);
index db0a948..b8a33ca 100644 (file)
@@ -1018,7 +1018,7 @@ static void analyze_general(object_type *o_ptr, char *desc_ptr)
  * List "player traits" altered by an artifact's pval. These include stats,
  * speed, infravision, tunneling, stealth, searching, and extra attacks.
  * @param o_ptr オブジェクト構造体の参照ポインタ
- * @param p_ptr pval修正構造体の参照ポインタ
+ * @param pi_ptr pval修正構造体の参照ポインタ
  * @return なし
  */
 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
index 273b676..cd135cc 100644 (file)
@@ -153,7 +153,7 @@ static bool do_cmd_debug_spell(player_type *creature_ptr)
 static bool wiz_dimension_door(void)
 {
        POSITION x = 0, y = 0;
-       if (!tgt_pt(&x, &y)) return FALSE;
+       if (!tgt_pt(p_ptr, &x, &y)) return FALSE;
        teleport_player_to(p_ptr, y, x, TELEPORT_NONMAGICAL);
        return (TRUE);
 }
@@ -1623,7 +1623,7 @@ static void do_cmd_wiz_create_feature(player_type *creature_ptr)
        FEAT_IDX          tmp_feat, tmp_mimic;
        POSITION y, x;
 
-       if (!tgt_pt(&x, &y)) return;
+       if (!tgt_pt(creature_ptr, &x, &y)) return;
 
        g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];