OSDN Git Service

[Refactor] #38997 get_direction() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Mon, 30 Dec 2019 13:27:32 +0000 (22:27 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 30 Dec 2019 13:27:32 +0000 (22:27 +0900)
src/cmd/cmd-activate.c
src/cmd/cmd-pet.c
src/mind.c
src/mutation.c
src/realm-hissatsu.c
src/spells-status.c
src/spells2.c
src/spells3.c
src/targeting.c
src/targeting.h

index e039f3b..655245c 100644 (file)
@@ -536,7 +536,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                else
                {
                        success = FALSE;
-                       if (!get_direction(&dir, FALSE, FALSE)) return;
+                       if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
                        if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
                        {
                                if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
index c42188f..4ea6cb7 100644 (file)
@@ -279,7 +279,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
        grid_type *g_ptr;
        monster_type *m_ptr;
 
-       if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+       if (!get_direction(creature_ptr, &dir, FALSE, 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];
index d066464..3305936 100644 (file)
@@ -1481,7 +1481,7 @@ static bool cast_berserk_spell(player_type *caster_ptr, int spell)
                        return FALSE;
                }
 
-               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+               if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
 
                if (dir == 5) return FALSE;
                y = caster_ptr->y + ddy[dir];
@@ -1510,7 +1510,7 @@ static bool cast_berserk_spell(player_type *caster_ptr, int spell)
        }
        case 2:
        {
-               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+               if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
                y = caster_ptr->y + ddy[dir];
                x = caster_ptr->x + ddx[dir];
                move_player(caster_ptr, dir, easy_disarm, TRUE);
index 891e6c1..766b371 100644 (file)
@@ -2294,7 +2294,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power)
                                grid_type *g_ptr;
                                monster_type *m_ptr;
                                monster_race *r_ptr;
-                               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+                               if (!get_direction(creature_ptr, &dir, FALSE, 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];
@@ -2339,7 +2339,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power)
                        {
                                POSITION x, y;
                                grid_type *g_ptr;
-                               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+                               if (!get_direction(creature_ptr, &dir, FALSE, 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];
index df10874..4ce6c89 100644 (file)
@@ -60,7 +60,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                        DIRECTION cdir;
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (cdir = 0; cdir < 8; cdir++)
@@ -112,7 +112,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -146,7 +146,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -194,7 +194,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                return NULL;
                        }
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
 
                        if (dir == 5) return NULL;
                        y = caster_ptr->y + ddy[dir];
@@ -230,7 +230,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -255,7 +255,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -279,7 +279,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -363,7 +363,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -389,7 +389,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -414,7 +414,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -439,7 +439,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -464,7 +464,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -490,7 +490,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -564,7 +564,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -639,7 +639,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        int i;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (i = 0; i < 3; i++)
@@ -721,7 +721,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -856,7 +856,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                        BIT_FLAGS flgs[TR_FLAG_SIZE];
                        object_type *o_ptr;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -906,7 +906,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
index e8274df..44563b9 100644 (file)
@@ -409,7 +409,7 @@ bool fishing(player_type *creature_ptr)
        DIRECTION dir;
        POSITION x, y;
 
-       if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+       if (!get_direction(creature_ptr, &dir, FALSE, FALSE)) return FALSE;
        y = creature_ptr->y + ddy[dir];
        x = creature_ptr->x + ddx[dir];
        creature_ptr->fishing_dir = dir;
index 6c8958f..441d215 100644 (file)
@@ -3863,7 +3863,7 @@ bool_hack vampirism(player_type *caster_ptr)
        }
 
        /* Only works on adjacent monsters */
-       if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
        y = caster_ptr->y + ddy[dir];
        x = caster_ptr->x + ddx[dir];
        g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
@@ -3906,7 +3906,7 @@ bool panic_hit(void)
        DIRECTION dir;
        POSITION x, y;
 
-       if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+       if (!get_direction(p_ptr, &dir, FALSE, FALSE)) return FALSE;
        y = p_ptr->y + ddy[dir];
        x = p_ptr->x + ddx[dir];
        if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx)
index c0a5f03..b556556 100644 (file)
@@ -3237,7 +3237,7 @@ bool eat_lock(player_type *caster_ptr)
        feature_type *f_ptr, *mimic_f_ptr;
        DIRECTION dir;
 
-       if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
        y = caster_ptr->y + ddy[dir];
        x = caster_ptr->x + ddx[dir];
        g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
index 51d785a..9ea8a01 100644 (file)
@@ -1653,7 +1653,7 @@ bool get_aim_dir(DIRECTION *dp)
 }
 
 
-bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed)
+bool get_direction(player_type *creature_ptr, DIRECTION *dp, bool allow_under, bool with_steed)
 {
        DIRECTION dir;
        concptr prompt;
@@ -1712,7 +1712,7 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed)
        command_dir = dir;
 
        /* Apply "confusion" */
-       if (p_ptr->confused)
+       if (creature_ptr->confused)
        {
                /* Standard confusion */
                if (randint0(100) < 75)
@@ -1721,9 +1721,9 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed)
                        dir = ddd[randint0(8)];
                }
        }
-       else if (p_ptr->riding && with_steed)
+       else if (creature_ptr->riding && with_steed)
        {
-               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))
@@ -1750,7 +1750,7 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed)
        /* Notice confusion */
        if (command_dir != dir)
        {
-               if (p_ptr->confused)
+               if (creature_ptr->confused)
                {
                        /* Warn the user */
                        msg_print(_("あなたは混乱している。", "You are confused."));
@@ -1758,7 +1758,7 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed)
                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))
index c6ee5e4..22b12c0 100644 (file)
@@ -21,6 +21,6 @@ extern bool target_set(BIT_FLAGS mode);
 extern void target_set_prepare_look(void);
 extern bool get_aim_dir(DIRECTION *dp);
 extern bool get_hack_dir(DIRECTION *dp);
-extern bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed);
+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);