OSDN Git Service

[Refactor] #37353 cnv_stat() と modify_stat_value() を player-status.c/h へ移動。
[hengband/hengband.git] / src / floor-save.c
index 327aa72..0f124ad 100644 (file)
@@ -18,6 +18,7 @@
 #include "quest.h"
 #include "wild.h"
 #include "spells-floor.h"
+#include "monster-status.h"
 
 
 static FLOOR_IDX new_floor_id;  /*!<次のフロアのID / floor_id of the destination */
@@ -194,8 +195,6 @@ saved_floor_type *get_sf_ptr(FLOOR_IDX floor_id)
 static void kill_saved_floor(saved_floor_type *sf_ptr)
 {
        char floor_savefile[1024];
-
-       /* Paranoia */
        if (!sf_ptr) return;
 
        /* Already empty */
@@ -396,7 +395,7 @@ static void preserve_pet(void)
                {
                        monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
-                       if (!m_ptr->r_idx) continue;
+                       if (!monster_is_valid(m_ptr)) continue;
                        if (!is_pet(m_ptr)) continue;
                        if (i == p_ptr->riding) continue;
 
@@ -446,7 +445,7 @@ static void preserve_pet(void)
                        monster_type *m_ptr = &current_floor_ptr->m_list[i];
                        GAME_TEXT m_name[MAX_NLEN];
 
-                       if (!m_ptr->r_idx) continue;
+                       if (!monster_is_valid(m_ptr)) continue;
                        if (!is_pet(m_ptr)) continue;
                        if (!m_ptr->nickname) continue;
                        if (p_ptr->riding == i) continue;
@@ -497,7 +496,7 @@ void precalc_cur_num_of_pet(void)
                m_ptr = &party_mon[i];
 
                /* Skip empty monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Hack -- Increase the racial counter */
                real_r_ptr(m_ptr)->cur_num++;
@@ -564,8 +563,6 @@ static void place_pet(void)
                        m_ptr->fx = cx;
                        m_ptr->ml = TRUE;
                        m_ptr->mtimed[MTIMED_CSLEEP] = 0;
-
-                       /* Paranoia */
                        m_ptr->hold_o_idx = 0;
                        m_ptr->target_y = 0;
 
@@ -636,8 +633,7 @@ static void update_unique_artifact(s16b cur_floor_id)
                monster_race *r_ptr;
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Extract real monster race */
                r_ptr = real_r_ptr(m_ptr);
@@ -893,8 +889,7 @@ void leave_floor(void)
                monster_race *r_ptr;
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Only maintain quest monsters */
                if (quest_r_idx != m_ptr->r_idx) continue;
@@ -1098,7 +1093,7 @@ void change_floor(void)
        panel_col_max = 0;
 
        /* Mega-Hack -- not ambushed on the wildness? */
-       ambush_flag = FALSE;
+       p_ptr->ambush_flag = FALSE;
 
        /* No saved floors (On the surface etc.) */
        if (!(change_floor_mode & CFM_SAVE_FLOORS) &&
@@ -1203,8 +1198,7 @@ void change_floor(void)
                                monster_race *r_ptr;
                                monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
-                               /* Skip dead monsters */
-                               if (!m_ptr->r_idx) continue;
+                               if (!monster_is_valid(m_ptr)) continue;
 
                                if (!is_pet(m_ptr))
                                {
@@ -1441,8 +1435,6 @@ void stair_creation(void)
 
        /* Extract current floor data */
        sf_ptr = get_sf_ptr(p_ptr->floor_id);
-
-       /* Paranoia */
        if (!sf_ptr)
        {
                /* No floor id? -- Create now! */