OSDN Git Service

[Refactor] #38997 player_has_los_bold() に player_type * 引数を追加. / Add player_type...
authordeskull <deskull@users.sourceforge.jp>
Tue, 12 Nov 2019 01:27:55 +0000 (10:27 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 12 Nov 2019 01:27:55 +0000 (10:27 +0900)
17 files changed:
src/cmd/cmd-mane.c
src/floor-save.c
src/floor.c
src/floor.h
src/geometry.c
src/grid.c
src/mind.c
src/monster-process.c
src/monster-status.c
src/monster2.c
src/mspells1.c
src/mspells2.c
src/mspells3.c
src/mspells4.c
src/spells1.c
src/spells2.c
src/spells3.c

index 7ad6506..2bba794 100644 (file)
@@ -293,7 +293,7 @@ static bool use_mane(player_type *caster_ptr, int spell)
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
-               if (!player_has_los_bold(target_row, target_col)) break;
+               if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
                if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
                dispel_monster_status(m_idx);
                break;
@@ -681,7 +681,7 @@ static bool use_mane(player_type *caster_ptr, int spell)
 
                if (!target_set(TARGET_KILL)) return FALSE;
                if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
-               if (!player_has_los_bold(target_row, target_col)) break;
+               if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
                if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
                m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
                r_ptr = &r_info[m_ptr->r_idx];
index f7875b6..ad93517 100644 (file)
@@ -451,7 +451,7 @@ static void preserve_pet(void)
                                 * when you or the pet can see the other.
                                 */
                                if (m_ptr->nickname && 
-                                   ((player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
+                                   ((player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
                                     (los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))))
                                {
                                        if (dis > 3) continue;
index 06fc583..978cfd4 100644 (file)
@@ -158,7 +158,7 @@ void update_smell(floor_type *floor_ptr)
                        if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !is_closed_door(g_ptr->feat)) continue;
 
                        /* Grid must not be blocked by walls from the character */
-                       if (!player_has_los_bold(y, x)) continue;
+                       if (!player_has_los_bold(p_ptr, y, x)) continue;
 
                        /* Note grids that are too far away */
                        if (scent_adjust[i][j] == -1) continue;
index c2e8e85..11139fe 100644 (file)
@@ -341,8 +341,8 @@ extern floor_type floor_info;
  *
  * Note the use of comparison to zero to force a "boolean" result
  */
-#define player_has_los_bold(Y,X) \
-    (((p_ptr->current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->phase_out)
+#define player_has_los_bold(C,Y,X) \
+    ((((C)->current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || (C)->phase_out)
 
 
 /*
index 191c5e5..515b6f1 100644 (file)
@@ -844,7 +844,7 @@ bool player_can_see_bold(POSITION y, POSITION x)
        if (g_ptr->info & (CAVE_LITE | CAVE_MNLT)) return TRUE;
 
        /* Require line of sight to the grid */
-       if (!player_has_los_bold(y, x)) return FALSE;
+       if (!player_has_los_bold(p_ptr, y, x)) return FALSE;
 
        /* Noctovision of Ninja */
        if (p_ptr->see_nocto) return TRUE;
index 4a07728..ce93922 100644 (file)
@@ -922,7 +922,7 @@ bool check_local_illumination(POSITION y, POSITION x)
 /*! 対象座標のマスの照明状態を更新する際の補助処理マクロ */
 #define update_local_illumination_aux(Y, X) \
 { \
-       if (player_has_los_bold((Y), (X))) \
+       if (player_has_los_bold(p_ptr, (Y), (X))) \
        { \
                /* Update the monster */ \
                if (p_ptr->current_floor_ptr->grid_array[(Y)][(X)].m_idx) update_monster(p_ptr->current_floor_ptr->grid_array[(Y)][(X)].m_idx, FALSE); \
@@ -1330,7 +1330,7 @@ void lite_spot(POSITION y, POSITION x)
  * grid and maintains an array of all "CAVE_VIEW" grids.
  *
  * This set of grids is the complete set of all grids within line of sight
- * of the player, allowing the "player_has_los_bold()" macro to work very
+ * of the player, allowing the "player_has_los_bold(p_ptr, )" macro to work very
  * quickly.
  *
  *
index 4c2f2f3..e3d35f7 100644 (file)
@@ -1245,7 +1245,7 @@ static bool cast_force_spell(player_type *caster_ptr, int spell)
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
-               if (!player_has_los_bold(target_row, target_col)) break;
+               if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
                if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
                dispel_monster_status(m_idx);
                break;
@@ -1646,7 +1646,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
                if (m_idx == caster_ptr->riding) break;
-               if (!player_has_los_bold(target_row, target_col)) break;
+               if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
                if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
                m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
                monster_desc(m_name, m_ptr, 0);
index d47615c..8d7002b 100644 (file)
@@ -430,7 +430,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no
        x1 = m_ptr->fx;
 
        /* Hack -- Player can see us, run towards him */
-       if (player_has_los_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)) return (FALSE);
+       if (player_has_los_bold(p_ptr, y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)) return (FALSE);
 
        /* Monster grid */
        g_ptr = &p_ptr->current_floor_ptr->grid_array[y1][x1];
@@ -1400,7 +1400,7 @@ void process_monster(MONSTER_IDX m_idx)
                                if (see_m)
                                {
                                        if ((r_ptr->flags2 & RF2_CAN_SPEAK) && (m_ptr->r_idx != MON_GRIP) && (m_ptr->r_idx != MON_WOLF) && (m_ptr->r_idx != MON_FANG) &&
-                                           player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))
+                                           player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))
                                        {
                                                msg_format(_("%^s「ピンチだ!退却させてもらう!」", "%^s says 'It is the pinch! I will retreat'."), m_name);
                                        }
@@ -1567,7 +1567,7 @@ void process_monster(MONSTER_IDX m_idx)
                /* Some monsters can speak */
                if ((ap_r_ptr->flags2 & RF2_CAN_SPEAK) && aware &&
                    one_in_(SPEAK_CHANCE) &&
-                   player_has_los_bold(oy, ox) &&
+                   player_has_los_bold(p_ptr, oy, ox) &&
                    projectable(oy, ox, p_ptr->y, p_ptr->x))
                {
                        GAME_TEXT m_name[MAX_NLEN];
@@ -2330,7 +2330,7 @@ void process_monster(MONSTER_IDX m_idx)
                                                did_kill_item = TRUE;
 
                                                /* Describe observable situations */
-                                               if (player_has_los_bold(ny, nx))
+                                               if (player_has_los_bold(p_ptr, ny, nx))
                                                {
                                                        msg_format(_("%^sが%sを破壊した。", "%^s destroys %s."), m_name, o_name);
                                                }
@@ -2567,7 +2567,7 @@ void process_monsters(void)
 
                /* Handle "sight" and "aggravation" */
         else if ((m_ptr->cdis <= MAX_SIGHT || p_ptr->phase_out) &&
-                       (player_has_los_bold(fy, fx) || (p_ptr->cursed & TRC_AGGRAVATE)))
+                       (player_has_los_bold(p_ptr, fy, fx) || (p_ptr->cursed & TRC_AGGRAVATE)))
                {
                        /* We can "see" or "feel" the player */
                        test = TRUE;
index a018ae5..9c6af39 100644 (file)
@@ -586,7 +586,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
                        }
 
                        /* Handle "sight" and "aggravation" */
-                       else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
+                       else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx)))
                        {
                                /* We may wake up */
                                test = TRUE;
@@ -839,7 +839,7 @@ bool set_monster_timewalk(int num, MONSTER_IDX who, bool vs_player)
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
        current_world_ptr->timewalk_m_idx = 0;
-       if (vs_player || (player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
+       if (vs_player || (player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
        {
                msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
                msg_print(NULL);
@@ -1406,4 +1406,4 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note)
 bool monster_is_valid(monster_type *m_ptr)
 {
        return (m_ptr->r_idx != 0);
-}
\ No newline at end of file
+}
index 90a2670..15fc329 100644 (file)
@@ -2035,7 +2035,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                }
 
                /* Normal line of sight, and not blind */
-               if (player_has_los_bold(fy, fx) && !p_ptr->blind)
+               if (player_has_los_bold(p_ptr, fy, fx) && !p_ptr->blind)
                {
                        bool do_invisible = FALSE;
                        bool do_cold_blood = FALSE;
index c97cb8a..59df968 100644 (file)
@@ -1377,7 +1377,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
 
        /* Extract the "see-able-ness" */
     bool seen = (!p_ptr->blind && m_ptr->ml);
-       bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
+       bool maneable = player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx);
 
        /* Check "projectable" */
        bool direct;
index 27eb8bb..5a5a021 100644 (file)
@@ -293,7 +293,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
        u32b f4, f5, f6;
 
        bool see_m = is_seen(m_ptr);
-       bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
+       bool maneable = player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx);
        bool pet = is_pet(m_ptr);
 
        bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && p_ptr->current_floor_ptr->dun_level
index 854772d..803ddbe 100644 (file)
@@ -863,7 +863,7 @@ static bool cast_learned_spell(int spell, bool success)
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
-               if (!player_has_los_bold(target_row, target_col)) break;
+               if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
                if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
                dispel_monster_status(m_idx);
                break;
@@ -1304,7 +1304,7 @@ static bool cast_learned_spell(int spell, bool success)
 
                if (!target_set(TARGET_KILL)) return FALSE;
                if (!p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
-               if (!player_has_los_bold(target_row, target_col)) break;
+               if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
                if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
                m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
                r_ptr = &r_info[m_ptr->r_idx];
index 9fe67c7..94a0152 100644 (file)
@@ -64,7 +64,7 @@ bool spell_learnable(MONSTER_IDX m_idx)
        /* Extract the "see-able-ness" */
        bool seen = (!p_ptr->blind && m_ptr->ml);
 
-       bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
+       bool maneable = player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx);
        return (seen && maneable && !current_world_ptr->timewalk_m_idx);
 }
 
index 87d2cc5..1446669 100644 (file)
@@ -274,7 +274,7 @@ static bool project_f(floor_type *floor_ptr, MONSTER_IDX who, POSITION r, POSITI
        feature_type *f_ptr = &f_info[g_ptr->feat];
 
        bool obvious = FALSE;
-       bool known = player_has_los_bold(y, x);
+       bool known = player_has_los_bold(p_ptr, y, x);
 
        who = who ? who : 0;
 
@@ -412,7 +412,7 @@ static bool project_f(floor_type *floor_ptr, MONSTER_IDX who, POSITION r, POSITI
                        }
 
                        /* Remove "unsafe" flag if player is not blind */
-                       if (!p_ptr->blind && player_has_los_bold(y, x))
+                       if (!p_ptr->blind && player_has_los_bold(p_ptr, y, x))
                        {
                                g_ptr->info &= ~(CAVE_UNSAFE);
                                lite_spot(y, x);
@@ -440,7 +440,7 @@ static bool project_f(floor_type *floor_ptr, MONSTER_IDX who, POSITION r, POSITI
                        }
 
                        /* Remove "unsafe" flag if player is not blind */
-                       if (!p_ptr->blind && player_has_los_bold(y, x))
+                       if (!p_ptr->blind && player_has_los_bold(p_ptr, y, x))
                        {
                                g_ptr->info &= ~(CAVE_UNSAFE);
                                lite_spot(y, x);
@@ -761,7 +761,7 @@ static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
        OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        bool obvious = FALSE;
-       bool known = player_has_los_bold(y, x);
+       bool known = player_has_los_bold(p_ptr, y, x);
 
        BIT_FLAGS flgs[TR_FLAG_SIZE];
 
@@ -5744,7 +5744,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                        if (!blind && !(flg & (PROJECT_HIDE)))
                        {
                                /* Only do visuals if the player can "see" the bolt */
-                               if (panel_contains(y, x) && player_has_los_bold(y, x))
+                               if (panel_contains(y, x) && player_has_los_bold(p_ptr, y, x))
                                {
                                        u16b p;
 
@@ -5876,7 +5876,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                        if (!blind && !(flg & (PROJECT_HIDE)))
                        {
                                /* Only do visuals if the player can "see" the bolt */
-                               if (panel_contains(y, x) && player_has_los_bold(y, x))
+                               if (panel_contains(y, x) && player_has_los_bold(p_ptr, y, x))
                                {
                                        u16b p;
 
@@ -6017,7 +6017,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
                {
                        /* Only do visuals if the player can "see" the bolt */
-                       if (panel_contains(y, x) && player_has_los_bold(y, x))
+                       if (panel_contains(y, x) && player_has_los_bold(p_ptr, y, x))
                        {
                                u16b p;
 
@@ -6178,7 +6178,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                                x = gx[i];
 
                                /* Only do visuals if the player can "see" the blast */
-                               if (panel_contains(y, x) && player_has_los_bold(y, x))
+                               if (panel_contains(y, x) && player_has_los_bold(p_ptr, y, x))
                                {
                                        u16b p;
 
@@ -6222,7 +6222,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                                x = gx[i];
 
                                /* Hack -- Erase if needed */
-                               if (panel_contains(y, x) && player_has_los_bold(y, x))
+                               if (panel_contains(y, x) && player_has_los_bold(p_ptr, y, x))
                                {
                                        lite_spot(y, x);
                                }
@@ -6627,7 +6627,7 @@ bool binding_field(HIT_POINT dam)
                        if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x]) &&
                                distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
                                distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
-                               player_has_los_bold(y, x) &&
+                               player_has_los_bold(p_ptr, y, x) &&
                                projectable(p_ptr->y, p_ptr->x, y, x)
                                ) {
                                mirror_y[mirror_num] = y;
@@ -6677,7 +6677,7 @@ bool binding_field(HIT_POINT dam)
                                centersign*((point_x[2] - x)*(point_y[0] - y)
                                        - (point_y[2] - y)*(point_x[0] - x)) >= 0)
                        {
-                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
+                               if (player_has_los_bold(p_ptr, y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        /* Visual effects */
                                        if (!(p_ptr->blind)
                                                && panel_contains(y, x)) {
@@ -6700,7 +6700,7 @@ bool binding_field(HIT_POINT dam)
                                centersign*((point_x[2] - x)*(point_y[0] - y)
                                        - (point_y[2] - y)*(point_x[0] - x)) >= 0)
                        {
-                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
+                               if (player_has_los_bold(p_ptr, y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        (void)project_f(p_ptr->current_floor_ptr, 0, 0, y, x, dam, GF_MANA);
                                }
                        }
@@ -6715,7 +6715,7 @@ bool binding_field(HIT_POINT dam)
                                centersign*((point_x[2] - x)*(point_y[0] - y)
                                        - (point_y[2] - y)*(point_x[0] - x)) >= 0)
                        {
-                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
+                               if (player_has_los_bold(p_ptr, y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        (void)project_o(0, 0, y, x, dam, GF_MANA);
                                }
                        }
@@ -6730,7 +6730,7 @@ bool binding_field(HIT_POINT dam)
                                centersign*((point_x[2] - x)*(point_y[0] - y)
                                        - (point_y[2] - y)*(point_x[0] - x)) >= 0)
                        {
-                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
+                               if (player_has_los_bold(p_ptr, y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        (void)project_m(0, 0, y, x, dam, GF_MANA,
                                                (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
                                }
index 59bcfe0..1ac603b 100644 (file)
@@ -796,7 +796,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
                x = m_ptr->fx;
 
                /* Require line of sight */
-               if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
+               if (!player_has_los_bold(p_ptr, y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
 
                /* Mark the monster */
                m_ptr->mflag |= (MFLAG_LOS);
@@ -996,7 +996,7 @@ void aggravate_monsters(MONSTER_IDX who)
                }
 
                /* Speed up monsters in line of sight */
-               if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
+               if (player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx))
                {
                        if (!is_pet(m_ptr))
                        {
@@ -1254,7 +1254,7 @@ bool probing(void)
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Require line of sight */
-               if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
+               if (!player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx)) continue;
 
                /* Probe visible monsters */
                if (m_ptr->ml)
index 92df8b4..ccf4618 100644 (file)
@@ -595,7 +595,7 @@ bool teleport_level_other(player_type *creature_ptr)
        if (!target_set(TARGET_KILL)) return FALSE;
        target_m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
        if (!target_m_idx) return TRUE;
-       if (!player_has_los_bold(target_row, target_col)) return TRUE;
+       if (!player_has_los_bold(p_ptr, target_row, target_col)) return TRUE;
        if (!projectable(creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE;
        m_ptr = &p_ptr->current_floor_ptr->m_list[target_m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
@@ -1285,7 +1285,7 @@ void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los)
                /* We need to see the item */
                if (require_los)
                {
-                       if (!player_has_los_bold(ty, tx))
+                       if (!player_has_los_bold(p_ptr, ty, tx))
                        {
                                msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
                                return;