OSDN Git Service

Separate 'massacre' process to independent function.
[hengband/hengband.git] / src / load.c
index 5287cae..9b731e8 100644 (file)
@@ -703,6 +703,15 @@ static void rd_monster_old(monster_type *m_ptr)
        {
                rd_s16b(&m_ptr->max_maxhp);
        }
+       if(h_older_than(2, 1, 2, 1))
+       {
+               m_ptr->dealt_damage = 0;
+       }
+       else
+       {
+               rd_u32b(&m_ptr->dealt_damage); 
+       }
+       
        rd_s16b(&m_ptr->mtimed[MTIMED_CSLEEP]);
        rd_byte(&m_ptr->mspeed);
        if (z_older_than(10, 4, 2))
@@ -825,6 +834,14 @@ static void rd_monster(monster_type *m_ptr)
        rd_s16b(&m_ptr->hp);
        rd_s16b(&m_ptr->maxhp);
        rd_s16b(&m_ptr->max_maxhp);
+       if(h_older_than(2, 1, 2, 1))
+       {
+               m_ptr->dealt_damage = 0;
+       }
+       else
+       {
+               rd_u32b(&m_ptr->dealt_damage); 
+       }
 
        /* Monster race index of its appearance */
        if (flags & SAVE_MON_AP_R_IDX) rd_s16b(&m_ptr->ap_r_idx);
@@ -1238,9 +1255,6 @@ static void rd_randomizer(void)
        {
                rd_u32b(&Rand_state[i]);
        }
-
-       /* Accept */
-       Rand_quick = FALSE;
 }
 
 
@@ -1796,6 +1810,10 @@ static void rd_extra(void)
        rd_s16b(&p_ptr->energy_need);
        if (z_older_than(11, 0, 13))
                p_ptr->energy_need = 100 - p_ptr->energy_need;
+       if (h_older_than(2, 1, 2, 0))
+               p_ptr->enchant_energy_need = 0;
+       else
+               rd_s16b(&p_ptr->enchant_energy_need);
 
        rd_s16b(&p_ptr->fast);
        rd_s16b(&p_ptr->slow);
@@ -2732,7 +2750,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        u32b tmp32u;
        u16b limit;
 
-       cave_template_type *template;
+       cave_template_type *templates;
 
 
        /*** Wipe all cave ***/
@@ -2799,12 +2817,12 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        rd_u16b(&limit);
 
        /* Allocate the "template" array */
-       C_MAKE(template, limit, cave_template_type);
+       C_MAKE(templates, limit, cave_template_type);
 
        /* Read the templates */
        for (i = 0; i < limit; i++)
        {
-               cave_template_type *ct_ptr = &template[i];
+               cave_template_type *ct_ptr = &templates[i];
 
                /* Read it */
                rd_u16b(&ct_ptr->info);
@@ -2852,10 +2870,10 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
                        cave_type *c_ptr = &cave[y][x];
 
                        /* Extract cave data */
-                       c_ptr->info = template[id].info;
-                       c_ptr->feat = template[id].feat;
-                       c_ptr->mimic = template[id].mimic;
-                       c_ptr->special = template[id].special;
+                       c_ptr->info = templates[id].info;
+                       c_ptr->feat = templates[id].feat;
+                       c_ptr->mimic = templates[id].mimic;
+                       c_ptr->special = templates[id].special;
 
                        /* Advance/Wrap */
                        if (++x >= xmax)
@@ -2899,7 +2917,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        }
 
        /* Free the "template" array */
-       C_FREE(template, limit, cave_template_type);
+       C_KILL(templates, limit, cave_template_type);
 
 
        /*** Objects ***/
@@ -3414,48 +3432,58 @@ note(format("
                {
                        if (i < max_quests)
                        {
-                               rd_s16b(&quest[i].status);
-                               rd_s16b(&quest[i].level);
+                               quest_type* const q_ptr = &quest[i];
+                               
+                               rd_s16b(&q_ptr->status);
+                               rd_s16b(&q_ptr->level);
 
                                if (z_older_than(11, 0, 6))
                                {
-                                       quest[i].complev = 0;
+                                       q_ptr->complev = 0;
+                               }
+                               else
+                               {
+                                       rd_byte(&q_ptr->complev);
+                               }
+                               if(h_older_than(2, 1, 2, 2))
+                               {
+                                       q_ptr->comptime = 0;
                                }
                                else
                                {
-                                       rd_byte(&quest[i].complev);
+                                       rd_u32b(&q_ptr->comptime);
                                }
 
                                /* Load quest status if quest is running */
-                               if ((quest[i].status == QUEST_STATUS_TAKEN) ||
-                                   (!z_older_than(10, 3, 14) && (quest[i].status == QUEST_STATUS_COMPLETED)) ||
+                               if ((q_ptr->status == QUEST_STATUS_TAKEN) ||
+                                   (!z_older_than(10, 3, 14) && (q_ptr->status == QUEST_STATUS_COMPLETED)) ||
                                    (!z_older_than(11, 0, 7) && (i >= MIN_RANDOM_QUEST) && (i <= (MIN_RANDOM_QUEST + max_rquests_load))))
                                {
-                                       rd_s16b(&quest[i].cur_num);
-                                       rd_s16b(&quest[i].max_num);
-                                       rd_s16b(&quest[i].type);
+                                       rd_s16b(&q_ptr->cur_num);
+                                       rd_s16b(&q_ptr->max_num);
+                                       rd_s16b(&q_ptr->type);
 
                                        /* Load quest monster index */
-                                       rd_s16b(&quest[i].r_idx);
+                                       rd_s16b(&q_ptr->r_idx);
 
-                                       if ((quest[i].type == QUEST_TYPE_RANDOM) && (!quest[i].r_idx))
+                                       if ((q_ptr->type == QUEST_TYPE_RANDOM) && (!q_ptr->r_idx))
                                        {
                                                determine_random_questor(&quest[i]);
                                        }
 
                                        /* Load quest item index */
-                                       rd_s16b(&quest[i].k_idx);
+                                       rd_s16b(&q_ptr->k_idx);
 
-                                       if (quest[i].k_idx)
-                                               a_info[quest[i].k_idx].gen_flags |= TRG_QUESTITEM;
+                                       if (q_ptr->k_idx)
+                                               a_info[q_ptr->k_idx].gen_flags |= TRG_QUESTITEM;
 
-                                       rd_byte(&quest[i].flags);
+                                       rd_byte(&q_ptr->flags);
 
                                        if (z_older_than(10, 3, 11))
                                        {
-                                               if (quest[i].flags & QUEST_FLAG_PRESET)
+                                               if (q_ptr->flags & QUEST_FLAG_PRESET)
                                                {
-                                                       quest[i].dungeon = 0;
+                                                       q_ptr->dungeon = 0;
                                                }
                                                else
                                                {
@@ -3468,12 +3496,12 @@ note(format("
                                        }
                                        else
                                        {
-                                               rd_byte(&quest[i].dungeon);
+                                               rd_byte(&q_ptr->dungeon);
                                        }
                                        /* Mark uniques */
-                                       if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_UNTAKEN)
-                                               if (r_info[quest[i].r_idx].flags1 & RF1_UNIQUE)
-                                                       r_info[quest[i].r_idx].flags1 |= RF1_QUESTOR;
+                                       if (q_ptr->status == QUEST_STATUS_TAKEN || q_ptr->status == QUEST_STATUS_UNTAKEN)
+                                               if (r_info[q_ptr->r_idx].flags1 & RF1_UNIQUE)
+                                                       r_info[q_ptr->r_idx].flags1 |= RF1_QUESTOR;
                                }
                        }
                        /* Ignore the empty quests from old versions */
@@ -3495,7 +3523,7 @@ note(format("
                /* Quest 18 was removed */
                if (h_older_than(1, 7, 0, 6))
                {
-                       WIPE(&quest[OLD_QUEST_WATER_CAVE], quest_type);
+                       (void)WIPE(&quest[OLD_QUEST_WATER_CAVE], quest_type);
                        quest[OLD_QUEST_WATER_CAVE].status = QUEST_STATUS_UNTAKEN;
                }