OSDN Git Service

[Refactor] #38997 melee1.c、grid.c、load.c、save.c 内変数参照修正 / Fixed variable references...
authorHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 16:41:40 +0000 (01:41 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 16:41:40 +0000 (01:41 +0900)
src/combat/melee1.c
src/grid.c
src/load.c
src/save.c

index 7657512..126f6f3 100644 (file)
@@ -1151,7 +1151,7 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att
        HIT_POINT k;
        int bonus, chance;
        WEIGHT n_weight = 0;
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       monster_type *m_ptr = &attacker_ptr->current_floor_ptr->m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
        GAME_TEXT m_name[MAX_NLEN];
 
@@ -1205,8 +1205,8 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att
        monster_desc(m_name, m_ptr, 0);
 
        /* Calculate the "attack quality" */
-       bonus = p_ptr->to_h_m + (p_ptr->lev * 6 / 5);
-       chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
+       bonus = attacker_ptr->to_h_m + (attacker_ptr->lev * 6 / 5);
+       chance = (attacker_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
 
        /* Test for hit */
        if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
@@ -1215,10 +1215,10 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att
                msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc);
 
                k = damroll(dice_num, dice_side);
-               k = critical_norm(p_ptr, n_weight, bonus, k, (s16b)bonus, 0);
+               k = critical_norm(attacker_ptr, n_weight, bonus, k, (s16b)bonus, 0);
 
                /* Apply the player damage bonuses */
-               k += p_ptr->to_d_m;
+               k += attacker_ptr->to_d_m;
 
                /* No negative damage */
                if (k < 0) k = 0;
@@ -1238,7 +1238,7 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att
                switch (attack)
                {
                case MUT2_SCOR_TAIL:
-                       project(p_ptr, 0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
+                       project(attacker_ptr, 0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
                        *mdeath = (m_ptr->r_idx == 0);
                        break;
                case MUT2_HORNS:
@@ -1257,7 +1257,7 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att
                        *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
                }
 
-               touch_zap_player(m_ptr, p_ptr);
+               touch_zap_player(m_ptr, attacker_ptr);
        }
        /* Player misses */
        else
@@ -2358,7 +2358,8 @@ bool py_attack(player_type *attacker_ptr, POSITION y, POSITION x, COMBAT_OPTION_
  */
 bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
        int ap_cnt;
@@ -3015,13 +3016,13 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
                                                msg_format("%sour %s (%c) was stolen!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i));
 #endif
                                                chg_virtue(target_ptr, V_SACRIFICE, 1);
-                                               o_idx = o_pop(target_ptr->current_floor_ptr);
+                                               o_idx = o_pop(floor_ptr);
 
                                                /* Success */
                                                if (o_idx)
                                                {
                                                        object_type *j_ptr;
-                                                       j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
+                                                       j_ptr = &floor_ptr->o_list[o_idx];
                                                        object_copy(j_ptr, o_ptr);
 
                                                        /* Modify number */
@@ -3836,7 +3837,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
                                                        r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK);
                                        }
 
-                                       if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[target_ptr->y][target_ptr->x]))
+                                       if (is_mirror_grid(&floor_ptr->grid_array[target_ptr->y][target_ptr->x]))
                                        {
                                                teleport_player(target_ptr, 10, 0L);
                                        }
@@ -4033,7 +4034,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
                if (target_ptr->riding && damage)
                {
                        char m_steed_name[MAX_NLEN];
-                       monster_desc(m_steed_name, &p_ptr->current_floor_ptr->m_list[target_ptr->riding], 0);
+                       monster_desc(m_steed_name, &floor_ptr->m_list[target_ptr->riding], 0);
                        if (rakuba(target_ptr, (damage > 200) ? 200 : damage, FALSE))
                        {
                                msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_steed_name);
@@ -4092,9 +4093,8 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
                }
        }
 
-
        /* Always notice cause of death */
-       if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !target_ptr->current_floor_ptr->inside_arena)
+       if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !floor_ptr->inside_arena)
        {
                r_ptr->r_deaths++;
        }
index 04b2e93..2c06677 100644 (file)
@@ -357,7 +357,7 @@ void update_local_illumination(player_type * creature_ptr, POSITION y, POSITION
        int i;
        POSITION yy, xx;
 
-       if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
+       if (!in_bounds(creature_ptr->current_floor_ptr, y, x)) return;
 
 #ifdef COMPLEX_WALL_ILLUMINATION /* COMPLEX_WALL_ILLUMINATION */
 
index a760701..d9c76c3 100644 (file)
@@ -2583,11 +2583,11 @@ static errr rd_dungeon_old(player_type *creature_ptr)
        rd_s16b(&tmp16s);
        floor_type *floor_ptr = creature_ptr->current_floor_ptr;
        floor_ptr->dun_level = (DEPTH)tmp16s;
-       if (z_older_than(10, 3, 8)) p_ptr->dungeon_idx = DUNGEON_ANGBAND;
+       if (z_older_than(10, 3, 8)) creature_ptr->dungeon_idx = DUNGEON_ANGBAND;
        else
        { 
                rd_byte(&tmp8u);
-               p_ptr->dungeon_idx = (IDX)tmp8u;
+               creature_ptr->dungeon_idx = (IDX)tmp8u;
        }
 
        /* Set the base level for old versions */
@@ -2599,10 +2599,10 @@ static errr rd_dungeon_old(player_type *creature_ptr)
        rd_s16b(&tmp16s);
        floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s;
        rd_s16b(&tmp16s);
-       p_ptr->y = (POSITION)tmp16s;
+       creature_ptr->y = (POSITION)tmp16s;
        rd_s16b(&tmp16s);
-       p_ptr->x = (POSITION)tmp16s;
-       if (z_older_than(10, 3, 13) && !floor_ptr->dun_level && !floor_ptr->inside_arena) {p_ptr->y = 33;p_ptr->x = 131;}
+       creature_ptr->x = (POSITION)tmp16s;
+       if (z_older_than(10, 3, 13) && !floor_ptr->dun_level && !floor_ptr->inside_arena) { creature_ptr->y = 33; creature_ptr->x = 131;}
        rd_s16b(&tmp16s);
        floor_ptr->height = (POSITION)tmp16s;
        rd_s16b(&tmp16s);
index a82f4f6..45c438f 100644 (file)
@@ -1117,13 +1117,13 @@ static bool wr_dungeon(player_type *player_ptr)
        saved_floor_type *cur_sf_ptr;
        int i;
 
-       forget_lite(p_ptr->current_floor_ptr);
-       forget_view(p_ptr->current_floor_ptr);
-       clear_mon_lite(p_ptr->current_floor_ptr);
+       forget_lite(player_ptr->current_floor_ptr);
+       forget_view(player_ptr->current_floor_ptr);
+       clear_mon_lite(player_ptr->current_floor_ptr);
 
        /* Update lite/view */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
-       p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
+       player_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
+       player_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
 
        /*** Meta info ***/
 
@@ -1131,11 +1131,11 @@ static bool wr_dungeon(player_type *player_ptr)
        wr_s16b(max_floor_id);
 
        /* Current dungeon type */
-       wr_byte((byte_hack)p_ptr->dungeon_idx);
+       wr_byte((byte_hack)player_ptr->dungeon_idx);
 
 
        /*** No saved floor (On the surface etc.) ***/
-       if (!p_ptr->floor_id)
+       if (!player_ptr->floor_id)
        {
                /* No array elements */
                wr_byte(0);
@@ -1168,7 +1168,7 @@ static bool wr_dungeon(player_type *player_ptr)
        }
 
        /* Extract pointer to current floor */
-       cur_sf_ptr = get_sf_ptr(p_ptr->floor_id);
+       cur_sf_ptr = get_sf_ptr(player_ptr->floor_id);
 
        /* Save current floor to temporary file */
        if (!save_floor(cur_sf_ptr, (SLF_SECOND))) return FALSE;
@@ -1735,7 +1735,7 @@ bool load_player(player_type *player_ptr)
        concptr    what = "generic";
 
        current_world_ptr->game_turn = 0;
-       p_ptr->is_dead = FALSE;
+       player_ptr->is_dead = FALSE;
 
 
        /* Allow empty savefile name */