OSDN Git Service

[Refactor] #38995 world_type 構造体に dungeon_turn を取り込む。 / Move dungeon_turn to world_t...
[hengband/hengband.git] / src / load.c
index 7e2dfd1..a87acef 100644 (file)
@@ -2256,10 +2256,10 @@ static void rd_extra(void)
        case RACE_SKELETON:
        case RACE_ZOMBIE:
        case RACE_SPECTRE:
-               turn_limit = TURNS_PER_TICK * TOWN_DAWN * MAX_DAYS + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
+               current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * MAX_DAYS + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
                break;
        default:
-               turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
+               current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
                break;
        }
        dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
@@ -2277,26 +2277,26 @@ static void rd_extra(void)
                rd_s32b(&p_ptr->feeling_turn);
        }
 
-       /* Current turn */
-       rd_s32b(&turn);
+       /* Current current_world_ptr->game_turn */
+       rd_s32b(&current_world_ptr->game_turn);
 
        if (z_older_than(10, 3, 12))
        {
-               dungeon_turn = turn;
+               current_world_ptr->dungeon_turn = current_world_ptr->game_turn;
        }
-       else rd_s32b(&dungeon_turn);
+       else rd_s32b(&current_world_ptr->dungeon_turn);
 
        if (z_older_than(11, 0, 13))
        {
                old_turn /= 2;
                p_ptr->feeling_turn /= 2;
-               turn /= 2;
-               dungeon_turn /= 2;
+               current_world_ptr->game_turn /= 2;
+               current_world_ptr->dungeon_turn /= 2;
        }
 
        if (z_older_than(10, 3, 13))
        {
-               old_battle = turn;
+               old_battle = current_world_ptr->game_turn;
        }
        else rd_s32b(&old_battle);
 
@@ -2572,16 +2572,16 @@ static errr rd_dungeon_old(void)
        current_floor_ptr->base_level = (DEPTH)tmp16s;
 
        rd_s16b(&tmp16s);
-       num_repro = (MONSTER_NUMBER)tmp16s;
+       current_floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s;
        rd_s16b(&tmp16s);
        p_ptr->y = (POSITION)tmp16s;
        rd_s16b(&tmp16s);
        p_ptr->x = (POSITION)tmp16s;
        if (z_older_than(10, 3, 13) && !current_floor_ptr->dun_level && !p_ptr->inside_arena) {p_ptr->y = 33;p_ptr->x = 131;}
        rd_s16b(&tmp16s);
-       cur_hgt = (POSITION)tmp16s;
+       current_floor_ptr->height = (POSITION)tmp16s;
        rd_s16b(&tmp16s);
-       cur_wid = (POSITION)tmp16s;
+       current_floor_ptr->width = (POSITION)tmp16s;
        rd_s16b(&tmp16s); /* max_panel_rows */
        rd_s16b(&tmp16s); /* max_panel_cols */
 
@@ -2590,8 +2590,8 @@ static errr rd_dungeon_old(void)
 #endif
 
        /* Maximal size */
-       ymax = cur_hgt;
-       xmax = cur_wid;
+       ymax = current_floor_ptr->height;
+       xmax = current_floor_ptr->width;
 
 
        /*** Run length decoding ***/
@@ -2835,7 +2835,7 @@ static errr rd_dungeon_old(void)
        rd_u16b(&limit);
 
        /* Verify maximum */
-       if (limit > max_o_idx)
+       if (limit > current_floor_ptr->max_o_idx)
        {
                note(format(_("アイテムの配列が大きすぎる(%d)!", "Too many (%d) object entries!"), limit));
                return (151);
@@ -2860,7 +2860,7 @@ static errr rd_dungeon_old(void)
 
 
                /* Acquire place */
-               o_ptr = &o_list[o_idx];
+               o_ptr = &current_floor_ptr->o_list[o_idx];
 
                /* Read the item */
                rd_item(o_ptr);
@@ -2874,7 +2874,7 @@ static errr rd_dungeon_old(void)
                        monster_type *m_ptr;
 
                        /* Monster */
-                       m_ptr = &m_list[o_ptr->held_m_idx];
+                       m_ptr = &current_floor_ptr->m_list[o_ptr->held_m_idx];
 
                        /* Build a stack */
                        o_ptr->next_o_idx = m_ptr->hold_o_idx;
@@ -2904,7 +2904,7 @@ static errr rd_dungeon_old(void)
        rd_u16b(&limit);
 
        /* Hack -- verify */
-       if (limit > max_m_idx)
+       if (limit > current_floor_ptr->max_m_idx)
        {
                note(format(_("モンスターの配列が大きすぎる(%d)!", "Too many (%d) monster entries!"), limit));
                return (161);
@@ -2927,7 +2927,7 @@ static errr rd_dungeon_old(void)
 
 
                /* Acquire monster */
-               m_ptr = &m_list[m_idx];
+               m_ptr = &current_floor_ptr->m_list[m_idx];
 
                /* Read the monster */
                rd_monster(m_ptr);
@@ -3031,7 +3031,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        rd_s16b(&tmp16s);
        current_floor_ptr->base_level = (DEPTH)tmp16s;
        rd_s16b(&tmp16s);
-       num_repro = (MONSTER_NUMBER)tmp16s;
+       current_floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s;
 
        rd_u16b(&tmp16u);
        p_ptr->y = (POSITION)tmp16u;
@@ -3040,9 +3040,9 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        p_ptr->x = (POSITION)tmp16u;
 
        rd_s16b(&tmp16s);
-       cur_hgt = (POSITION)tmp16s;
+       current_floor_ptr->height = (POSITION)tmp16s;
        rd_s16b(&tmp16s);
-       cur_wid = (POSITION)tmp16s;
+       current_floor_ptr->width = (POSITION)tmp16s;
 
        rd_byte(&p_ptr->feeling);
 
@@ -3080,8 +3080,8 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        }
 
        /* Maximal size */
-       ymax = cur_hgt;
-       xmax = cur_wid;
+       ymax = current_floor_ptr->height;
+       xmax = current_floor_ptr->width;
 
 
        /*** Run length decoding ***/
@@ -3164,7 +3164,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        rd_u16b(&limit);
 
        /* Verify maximum */
-       if (limit > max_o_idx) return 151;
+       if (limit > current_floor_ptr->max_o_idx) return 151;
 
 
        /* Read the dungeon items */
@@ -3180,7 +3180,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
                if (i != o_idx) return 152;
 
                /* Acquire place */
-               o_ptr = &o_list[o_idx];
+               o_ptr = &current_floor_ptr->o_list[o_idx];
 
                /* Read the item */
                rd_item(o_ptr);
@@ -3192,7 +3192,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
                        monster_type *m_ptr;
 
                        /* Monster */
-                       m_ptr = &m_list[o_ptr->held_m_idx];
+                       m_ptr = &current_floor_ptr->m_list[o_ptr->held_m_idx];
 
                        /* Build a stack */
                        o_ptr->next_o_idx = m_ptr->hold_o_idx;
@@ -3222,7 +3222,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        rd_u16b(&limit);
 
        /* Hack -- verify */
-       if (limit > max_m_idx) return 161;
+       if (limit > current_floor_ptr->max_m_idx) return 161;
 
        /* Read the monsters */
        for (i = 1; i < limit; i++)
@@ -3238,7 +3238,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
 
 
                /* Acquire monster */
-               m_ptr = &m_list[m_idx];
+               m_ptr = &current_floor_ptr->m_list[m_idx];
 
                /* Read the monster */
                rd_monster(m_ptr);
@@ -3707,7 +3707,7 @@ static errr rd_savefile_new_aux(void)
                rd_s32b(&wild_y_size);
 
                /* Incompatible save files */
-               if ((wild_x_size > max_wild_x) || (wild_y_size > max_wild_y))
+               if ((wild_x_size > current_world_ptr->max_wild_x) || (wild_y_size > current_world_ptr->max_wild_y))
                {
                        note(format(_("荒野が大きすぎる(%u/%u)!", "Wilderness is too big (%u/%u)!"), wild_x_size, wild_y_size));
                        return (23);