OSDN Git Service

(2.2.0.17) avater.cとeffect.c内のC4457警告に対応。 / Deal C4457 warning in avater.c, effect.c.
[hengband/hengband.git] / src / spells3.c
index 70bff91..1ac238a 100644 (file)
@@ -350,10 +350,10 @@ bool teleport_player_aux(int dis, u32b mode)
        int total_candidates, cur_candidates;
        int y = 0, x = 0, min, pick, i;
 
-       int left = MAX(1, px - dis);
-       int right = MIN(cur_wid - 2, px + dis);
-       int top = MAX(1, py - dis);
-       int bottom = MIN(cur_hgt - 2, py + dis);
+       int left = MAX(1, p_ptr->x - dis);
+       int right = MIN(cur_wid - 2, p_ptr->x + dis);
+       int top = MAX(1, p_ptr->y - dis);
+       int bottom = MIN(cur_hgt - 2, p_ptr->y + dis);
 
        if (p_ptr->wild_mode) return FALSE;
 
@@ -382,7 +382,7 @@ bool teleport_player_aux(int dis, u32b mode)
                        if (!cave_player_teleportable_bold(y, x, mode)) continue;
 
                        /* Calculate distance */
-                       d = distance(py, px, y, x);
+                       d = distance(p_ptr->y, p_ptr->x, y, x);
 
                        /* Skip too far locations */
                        if (d > dis) continue;
@@ -421,7 +421,7 @@ bool teleport_player_aux(int dis, u32b mode)
                        if (!cave_player_teleportable_bold(y, x, mode)) continue;
 
                        /* Calculate distance */
-                       d = distance(py, px, y, x);
+                       d = distance(p_ptr->y, p_ptr->x, y, x);
 
                        /* Skip too far locations */
                        if (d > dis) continue;
@@ -445,7 +445,7 @@ bool teleport_player_aux(int dis, u32b mode)
 
 #ifdef JP
        if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-               msg_format("『こっちだぁ、%s』", player_name);
+               msg_format("『こっちだぁ、%s』", p_ptr->name);
 #endif
 
        /* Move the player */
@@ -465,8 +465,8 @@ void teleport_player(int dis, u32b mode)
        int yy, xx;
 
        /* Save the old location */
-       int oy = py;
-       int ox = px;
+       int oy = p_ptr->y;
+       int ox = p_ptr->x;
 
        if (!teleport_player_aux(dis, mode)) return;
 
@@ -490,7 +490,7 @@ void teleport_player(int dis, u32b mode)
                                if ((r_ptr->flags6 & RF6_TPORT) &&
                                    !(r_ptr->flagsr & RFR_RES_TELE))
                                {
-                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L);
+                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
                                }
                        }
                }
@@ -509,8 +509,8 @@ void teleport_player_away(int m_idx, int dis)
        int yy, xx;
 
        /* Save the old location */
-       int oy = py;
-       int ox = px;
+       int oy = p_ptr->y;
+       int ox = p_ptr->x;
 
        if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return;
 
@@ -534,7 +534,7 @@ void teleport_player_away(int m_idx, int dis)
                                if ((r_ptr->flags6 & RF6_TPORT) &&
                                    !(r_ptr->flagsr & RFR_RES_TELE))
                                {
-                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L);
+                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
                                }
                        }
                }
@@ -608,7 +608,7 @@ void teleport_away_followable(int m_idx)
 
        teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
 
-       if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(py, px, oldfy, oldfx))
+       if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(p_ptr->y, p_ptr->x, oldfy, oldfx))
        {
                bool follow = FALSE;
 
@@ -713,8 +713,8 @@ void teleport_level(int m_idx)
                        if (!dun_level)
                        {
                                dungeon_type = p_ptr->recall_dungeon;
-                               p_ptr->oldpy = py;
-                               p_ptr->oldpx = px;
+                               p_ptr->oldpy = p_ptr->y;
+                               p_ptr->oldpx = p_ptr->x;
                        }
 
                        if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
@@ -1597,7 +1597,7 @@ void call_the_(void)
 
        for (i = 0; i < 9; i++)
        {
-               c_ptr = &cave[py + ddy_ddd[i]][px + ddx_ddd[i]];
+               c_ptr = &cave[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]];
 
                if (!cave_have_flag_grid(c_ptr, FF_PROJECT))
                {
@@ -1653,7 +1653,7 @@ void call_the_(void)
                }
                else
                {
-                       if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE))
+                       if (destroy_area(p_ptr->y, p_ptr->x, 15 + p_ptr->lev + randint0(11), FALSE))
                                msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses..."));
                        else
                                msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles."));
@@ -1680,7 +1680,7 @@ void fetch(int dir, int wgt, bool require_los)
        char            o_name[MAX_NLEN];
 
        /* Check to see if an object is already there */
-       if (cave[py][px].o_idx)
+       if (cave[p_ptr->y][p_ptr->x].o_idx)
        {
                msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something."));
                return;
@@ -1692,7 +1692,7 @@ void fetch(int dir, int wgt, bool require_los)
                tx = target_col;
                ty = target_row;
 
-               if (distance(py, px, ty, tx) > MAX_RANGE)
+               if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE)
                {
                        msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!"));
                        return;
@@ -1722,7 +1722,7 @@ void fetch(int dir, int wgt, bool require_los)
                                msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
                                return;
                        }
-                       else if (!projectable(py, px, ty, tx))
+                       else if (!projectable(p_ptr->y, p_ptr->x, ty, tx))
                        {
                                msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location."));
                                return;
@@ -1732,8 +1732,8 @@ void fetch(int dir, int wgt, bool require_los)
        else
        {
                /* Use a direction */
-               ty = py; /* Where to drop the item */
-               tx = px;
+               ty = p_ptr->y; /* Where to drop the item */
+               tx = p_ptr->x;
 
                do
                {
@@ -1741,7 +1741,7 @@ void fetch(int dir, int wgt, bool require_los)
                        tx += ddx[dir];
                        c_ptr = &cave[ty][tx];
 
-                       if ((distance(py, px, ty, tx) > MAX_RANGE) ||
+                       if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) ||
                                !cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
                }
                while (!c_ptr->o_idx);
@@ -1758,15 +1758,15 @@ void fetch(int dir, int wgt, bool require_los)
 
        i = c_ptr->o_idx;
        c_ptr->o_idx = o_ptr->next_o_idx;
-       cave[py][px].o_idx = i; /* 'move' it */
+       cave[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
        o_ptr->next_o_idx = 0;
-       o_ptr->iy = (byte)py;
-       o_ptr->ix = (byte)px;
+       o_ptr->iy = (byte)p_ptr->y;
+       o_ptr->ix = (byte)p_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(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
        p_ptr->redraw |= PR_MAP;
 }
 
@@ -1810,21 +1810,21 @@ void alter_reality(void)
 bool warding_glyph(void)
 {
        /* XXX XXX XXX */
-       if (!cave_clean_bold(py, px))
+       if (!cave_clean_bold(p_ptr->y, p_ptr->x))
        {
                msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
                return FALSE;
        }
 
        /* Create a glyph */
-       cave[py][px].info |= CAVE_OBJECT;
-       cave[py][px].mimic = feat_glyph;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
+       cave[p_ptr->y][p_ptr->x].mimic = feat_glyph;
 
        /* Notice */
-       note_spot(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
 
        /* Redraw */
-       lite_spot(py, px);
+       lite_spot(p_ptr->y, p_ptr->x);
 
        return TRUE;
 }
@@ -1836,26 +1836,26 @@ bool warding_glyph(void)
 bool place_mirror(void)
 {
        /* XXX XXX XXX */
-       if (!cave_clean_bold(py, px))
+       if (!cave_clean_bold(p_ptr->y, p_ptr->x))
        {
                msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
                return FALSE;
        }
 
        /* Create a mirror */
-       cave[py][px].info |= CAVE_OBJECT;
-       cave[py][px].mimic = feat_mirror;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
+       cave[p_ptr->y][p_ptr->x].mimic = feat_mirror;
 
        /* Turn on the light */
-       cave[py][px].info |= CAVE_GLOW;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_GLOW;
 
        /* Notice */
-       note_spot(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
 
        /* Redraw */
-       lite_spot(py, px);
+       lite_spot(p_ptr->y, p_ptr->x);
 
-       update_local_illumination(py, px);
+       update_local_illumination(p_ptr->y, p_ptr->x);
 
        return TRUE;
 }
@@ -1869,21 +1869,21 @@ bool place_mirror(void)
 bool explosive_rune(void)
 {
        /* XXX XXX XXX */
-       if (!cave_clean_bold(py, px))
+       if (!cave_clean_bold(p_ptr->y, p_ptr->x))
        {
                msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
                return FALSE;
        }
 
        /* Create a glyph */
-       cave[py][px].info |= CAVE_OBJECT;
-       cave[py][px].mimic = feat_explosive_rune;
+       cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
+       cave[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune;
 
        /* Notice */
-       note_spot(py, px);
+       note_spot(p_ptr->y, p_ptr->x);
        
        /* Redraw */
-       lite_spot(py, px);
+       lite_spot(p_ptr->y, p_ptr->x);
 
        return TRUE;
 }
@@ -3646,9 +3646,6 @@ void display_spell_list(void)
            (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
            (p_ptr->pclass == CLASS_FORCETRAINER))
        {
-               int             i;
-               int             y = 1;
-               int             x = 1;
                int             minfail = 0;
                int             plev = p_ptr->lev;
                int             chance = 0;
@@ -3658,6 +3655,9 @@ void display_spell_list(void)
                int             use_mind;
                bool use_hp = FALSE;
 
+               y = 1;
+               x = 1;
+
                /* Display a list of spells */
                prt("", y, x);
                put_str(_("名前", "Name"), y, x + 5);
@@ -4571,7 +4571,7 @@ o_name, index_to_label(i),
                                /* Potions smash open */
                                if (object_is_potion(o_ptr))
                                {
-                                       (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
+                                       (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, o_ptr->k_idx);
                                }
 
                                /* Reduce the charges of rods/wands */
@@ -5304,7 +5304,7 @@ static bool dimension_door_aux(int x, int y)
        p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
 
        if (!cave_player_teleportable_bold(y, x, 0L) ||
-           (distance(y, x, py, px) > plev / 2 + 10) ||
+           (distance(y, x, p_ptr->y, p_ptr->x) > plev / 2 + 10) ||
            (!randint0(plev / 10 + 10)))
        {
                p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
@@ -5762,7 +5762,7 @@ bool summon_kin_player(int level, int y, int x, u32b mode)
  * @param px プレイヤーX座標
  * @return なし
  */
-void massacre(int py, int px)
+void massacre(void)
 {
        int x, y;
        cave_type       *c_ptr;
@@ -5771,8 +5771,8 @@ void massacre(int py, int px)
 
        for (dir = 0; dir < 8; dir++)
        {
-               y = py + ddy_ddd[dir];
-               x = px + ddx_ddd[dir];
+               y = p_ptr->y + ddy_ddd[dir];
+               x = p_ptr->x + ddx_ddd[dir];
                c_ptr = &cave[y][x];
 
                /* Get the monster */