OSDN Git Service

[Refactor] #38997 select_floor_music() に player_type * 引数を追加. / Add player_type ...
[hengband/hengband.git] / src / floor-save.c
index f8e25e8..a439fed 100644 (file)
@@ -342,19 +342,18 @@ void prepare_change_floor_mode(BIT_FLAGS mode)
  * @brief 階段移動先のフロアが生成できない時に簡単な行き止まりマップを作成する / Builds the dead end
  * @return なし
  */
-static void build_dead_end(void)
+static void build_dead_end(floor_type *floor_ptr)
 {
        POSITION x, y;
 
-       /* Clear and empty the current_floor_ptr->grid_array */
-       clear_cave();
+       clear_cave(floor_ptr);
 
        /* Fill the arrays of floors and walls in the good proportions */
        set_floor_and_wall(0);
 
        /* Smallest area */
-       current_floor_ptr->height = SCREEN_HGT;
-       current_floor_ptr->width = SCREEN_WID;
+       floor_ptr->height = SCREEN_HGT;
+       floor_ptr->width = SCREEN_WID;
 
        /* Filled with permanent walls */
        for (y = 0; y < MAX_HGT; y++)
@@ -367,13 +366,13 @@ static void build_dead_end(void)
        }
 
        /* Place at center of the floor */
-       p_ptr->y = current_floor_ptr->height / 2;
-       p_ptr->x = current_floor_ptr->width / 2;
+       p_ptr->y = floor_ptr->height / 2;
+       p_ptr->x = floor_ptr->width / 2;
 
        /* Give one square */
        place_floor_bold(p_ptr->y, p_ptr->x);
 
-       wipe_generate_random_floor_flags();
+       wipe_generate_random_floor_flags(floor_ptr);
 }
 
 
@@ -538,10 +537,10 @@ void precalc_cur_num_of_pet(void)
  * @brief 移動先のフロアに伴ったペットを配置する / Place preserved pet monsters on new floor
  * @return なし
  */
-static void place_pet(void)
+static void place_pet(player_type *master_ptr)
 {
        int i;
-       int max_num = p_ptr->wild_mode ? 1 : MAX_PARTY_MON;
+       int max_num = master_ptr->wild_mode ? 1 : MAX_PARTY_MON;
 
        for (i = 0; i < max_num; i++)
        {
@@ -553,11 +552,11 @@ static void place_pet(void)
                if (i == 0)
                {
                        m_idx = m_pop();
-                       p_ptr->riding = m_idx;
+                       master_ptr->riding = m_idx;
                        if (m_idx)
                        {
-                               cy = p_ptr->y;
-                               cx = p_ptr->x;
+                               cy = master_ptr->y;
+                               cx = master_ptr->x;
                        }
                }
                else
@@ -569,7 +568,7 @@ static void place_pet(void)
                        {
                                for (j = 1000; j > 0; j--)
                                {
-                                       scatter(&cy, &cx, p_ptr->y, p_ptr->x, d, 0);
+                                       scatter(&cy, &cx, master_ptr->y, master_ptr->x, d, 0);
                                        if (monster_can_enter(cy, cx, &r_info[party_mon[i].r_idx], 0)) break;
                                }
                                if (j) break;
@@ -626,7 +625,7 @@ static void place_pet(void)
                        if (record_named_pet && m_ptr->nickname)
                        {
                                monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                               exe_write_diary(p_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, m_name);
+                               exe_write_diary(master_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, m_name);
                        }
 
                        /* Pre-calculated in precalc_cur_num_of_pet(), but need to decrease */
@@ -1069,7 +1068,7 @@ void leave_floor(BIT_FLAGS floor_mode)
 
                forget_lite();
                forget_view();
-               clear_mon_lite();
+               clear_mon_lite(current_floor_ptr);
 
                /* Save current floor */
                if (!save_floor(sf_ptr, 0))
@@ -1117,7 +1116,7 @@ void change_floor(BIT_FLAGS floor_mode)
            !(floor_mode & CFM_FIRST_FLOOR))
        {
                /* Create current_floor_ptr->grid_array */
-               generate_random_floor();
+               generate_random_floor(current_floor_ptr);
 
                /* Paranoia -- No new saved floor */
                new_floor_id = 0;
@@ -1294,7 +1293,7 @@ void change_floor(BIT_FLAGS floor_mode)
                                msg_print(_("階段は行き止まりだった。", "The staircases come to a dead end..."));
 
                                /* Create simple dead end */
-                               build_dead_end();
+                               build_dead_end(current_floor_ptr);
 
                                /* Break connection */
                                if (floor_mode & CFM_UP)
@@ -1309,7 +1308,7 @@ void change_floor(BIT_FLAGS floor_mode)
                        else
                        {
                                /* Newly create current_floor_ptr->grid_array */
-                               generate_random_floor();
+                               generate_random_floor(current_floor_ptr);
                        }
 
                        /* Record last visit current_world_ptr->game_turn */
@@ -1377,7 +1376,7 @@ void change_floor(BIT_FLAGS floor_mode)
        }
 
        /* Place preserved pet monsters */
-       place_pet();
+       place_pet(p_ptr);
 
        /* Reset travel target place */
        forget_travel_flow();
@@ -1393,7 +1392,7 @@ void change_floor(BIT_FLAGS floor_mode)
 
        /* Hack -- Munchkin characters always get whole map */
        if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
-               wiz_lite((bool)(p_ptr->pclass == CLASS_NINJA));
+               wiz_lite(p_ptr, (bool)(p_ptr->pclass == CLASS_NINJA));
 
        /* Remember when this level was "created" */
        current_floor_ptr->generated_turn = current_world_ptr->game_turn;
@@ -1405,6 +1404,6 @@ void change_floor(BIT_FLAGS floor_mode)
        /* Clear all flags */
        floor_mode = 0L;
 
-       select_floor_music();
+       select_floor_music(p_ptr);
        p_ptr->change_floor_mode = 0;
 }