From a1570ec52ecdc86fde9efec4c4b80d86fa53e775 Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 4 Jan 2020 16:56:31 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20tgt=5Fpt()=20=E3=81=AB=20p?= =?utf8?q?layer=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0?= =?utf8?q?=EF=BC=8E=20/=20Add=20player=5Ftype=20*=20argument=20to=20tgt=5F?= =?utf8?q?pt().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/player-move.c | 2 +- src/realm-hex.c | 2 +- src/realm-hissatsu.c | 2 +- src/spells3.c | 4 ++-- src/targeting.c | 30 +++++++++++++++--------------- src/targeting.h | 2 +- src/wizard1.c | 2 +- src/wizard2.c | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/player-move.c b/src/player-move.c index fed968c53..7335d8c76 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -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)) { diff --git a/src/realm-hex.c b/src/realm-hex.c index 47e135541..d279d2ce0 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -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; diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 40f738177..37a8c9e84 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -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) || diff --git a/src/spells3.c b/src/spells3.c index 91314834a..2d2a9dacc 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -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; diff --git a/src/targeting.c b/src/targeting.c index fb7cf3c6d..ba8a56684 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -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; diff --git a/src/targeting.h b/src/targeting.h index 22b12c087..db16b74a0 100644 --- a/src/targeting.h +++ b/src/targeting.h @@ -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); diff --git a/src/wizard1.c b/src/wizard1.c index db0a948c1..b8a33ca3f 100644 --- a/src/wizard1.c +++ b/src/wizard1.c @@ -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) diff --git a/src/wizard2.c b/src/wizard2.c index 273b67617..cd135cc0b 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -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]; -- 2.11.0