From: Hourier Date: Mon, 13 Jan 2020 12:08:48 +0000 (+0900) Subject: [Refactor] #38997 get_rep_dir() にplayer_type * 引数を追加 / Added player_type * argument... X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=e262b6e67e35ab65a80615f0032ad643dd60a48d [Refactor] #38997 get_rep_dir() にplayer_type * 引数を追加 / Added player_type * argument to get_rep_dir() --- diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index 2bd1d1597..2729b9379 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -830,7 +830,7 @@ void do_cmd_open(player_type *creature_ptr) } /* Get a "repeated" direction */ - if (get_rep_dir(&dir, TRUE)) + if (get_rep_dir(creature_ptr, &dir, TRUE)) { FEAT_IDX feat; grid_type *g_ptr; @@ -973,7 +973,7 @@ void do_cmd_close(player_type *creature_ptr) } /* Get a "repeated" direction */ - if (get_rep_dir(&dir, FALSE)) + if (get_rep_dir(creature_ptr, &dir, FALSE)) { grid_type *g_ptr; FEAT_IDX feat; @@ -1209,7 +1209,7 @@ void do_cmd_tunnel(player_type *creature_ptr) } /* Get a direction to tunnel, or Abort */ - if (get_rep_dir(&dir,FALSE)) + if (get_rep_dir(creature_ptr, &dir,FALSE)) { /* Get location */ y = creature_ptr->y + ddy[dir]; @@ -1563,7 +1563,7 @@ void do_cmd_disarm(player_type *creature_ptr) } /* Get a direction (or abort) */ - if (get_rep_dir(&dir,TRUE)) + if (get_rep_dir(creature_ptr, &dir,TRUE)) { grid_type *g_ptr; FEAT_IDX feat; @@ -1745,7 +1745,7 @@ void do_cmd_bash(player_type *creature_ptr) } /* Get a "repeated" direction */ - if (get_rep_dir(&dir,FALSE)) + if (get_rep_dir(creature_ptr, &dir,FALSE)) { FEAT_IDX feat; @@ -1827,7 +1827,7 @@ void do_cmd_alter(player_type *creature_ptr) } /* Get a direction */ - if (get_rep_dir(&dir,TRUE)) + if (get_rep_dir(creature_ptr, &dir,TRUE)) { FEAT_IDX feat; feature_type *f_ptr; @@ -1946,7 +1946,7 @@ void do_cmd_spike(player_type *creature_ptr) } /* Get a "repeated" direction */ - if (!get_rep_dir(&dir, FALSE)) return; + if (!get_rep_dir(creature_ptr, &dir, FALSE)) return; POSITION y = creature_ptr->y + ddy[dir]; POSITION x = creature_ptr->x + ddx[dir]; @@ -2017,7 +2017,7 @@ void do_cmd_walk(player_type *creature_ptr, bool pickup) /* Get a "repeated" direction */ bool more = FALSE; DIRECTION dir; - if (get_rep_dir(&dir, FALSE)) + if (get_rep_dir(creature_ptr, &dir, FALSE)) { take_turn(creature_ptr, 100); @@ -2081,7 +2081,7 @@ void do_cmd_run(player_type *creature_ptr) } /* Get a "repeated" direction */ - if (get_rep_dir(&dir,FALSE)) + if (get_rep_dir(creature_ptr, &dir,FALSE)) { /* Hack -- Set the run counter */ creature_ptr->running = (command_arg ? command_arg : 1000); diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 858726a43..7d1a08270 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -825,7 +825,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo { POSITION x, y; - if (!get_rep_dir(&dir, FALSE)) return NULL; + if (!get_rep_dir(caster_ptr, &dir, FALSE)) return NULL; y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; diff --git a/src/spells-object.c b/src/spells-object.c index e31896153..db71d6070 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -135,7 +135,7 @@ bool create_ammo(player_type *creature_ptr) DIRECTION dir; grid_type *g_ptr; - if (!get_rep_dir(&dir, FALSE)) return FALSE; + if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE; y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x]; diff --git a/src/spells2.c b/src/spells2.c index dc9cdb868..84a1a05f4 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -4460,7 +4460,7 @@ void hayagake(player_type *creature_ptr) bool double_attack(player_type *creature_ptr) { DIRECTION dir; - if (!get_rep_dir(&dir, FALSE)) return FALSE; + if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE; POSITION y = creature_ptr->y + ddy[dir]; POSITION x = creature_ptr->x + ddx[dir]; if (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx) diff --git a/src/targeting.c b/src/targeting.c index fdd0b22a6..38903dedd 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -1803,7 +1803,7 @@ bool get_direction(player_type *creature_ptr, DIRECTION *dp, bool allow_under, b * This function tracks and uses the "global direction", and uses * that as the "desired direction", to which "confusion" is applied. */ -bool get_rep_dir(DIRECTION *dp, bool under) +bool get_rep_dir(player_type *creature_ptr, DIRECTION *dp, bool under) { DIRECTION dir; concptr prompt; @@ -1862,7 +1862,7 @@ bool get_rep_dir(DIRECTION *dp, bool under) command_dir = dir; /* Apply "confusion" */ - if (p_ptr->confused) + if (creature_ptr->confused) { /* Standard confusion */ if (randint0(100) < 75) @@ -1871,9 +1871,9 @@ bool get_rep_dir(DIRECTION *dp, bool under) dir = ddd[randint0(8)]; } } - else if (p_ptr->riding) + else if (creature_ptr->riding) { - monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (MON_CONFUSED(m_ptr)) @@ -1900,7 +1900,7 @@ bool get_rep_dir(DIRECTION *dp, bool under) /* Notice confusion */ if (command_dir != dir) { - if (p_ptr->confused) + if (creature_ptr->confused) { /* Warn the user */ msg_print(_("あなたは混乱している。", "You are confused.")); @@ -1908,7 +1908,7 @@ bool get_rep_dir(DIRECTION *dp, bool under) else { GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding]; monster_desc(m_name, m_ptr, 0); if (MON_CONFUSED(m_ptr)) diff --git a/src/targeting.h b/src/targeting.h index 1bd08d55a..322cf9bc7 100644 --- a/src/targeting.h +++ b/src/targeting.h @@ -22,5 +22,5 @@ extern void target_set_prepare_look(player_type *creature_ptr); extern bool get_aim_dir(player_type *creature_ptr, DIRECTION *dp); extern bool get_hack_dir(player_type *creature_ptr, 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 get_rep_dir(player_type *creature_ptr, DIRECTION *dp, bool under); extern bool tgt_pt(player_type *creature_ptr, POSITION *x, POSITION *y);