OSDN Git Service

[Refactor] #37353 型の置換。 / Type replacement. (BASE_STATUS / A_MAX)
[hengband/hengband.git] / src / load.c
index 0be7fb4..d57c92d 100644 (file)
 #include "angband.h"
 #include "generate.h"
 #include "trap.h"
+#include "mutation.h"
+#include "quest.h"
+#include "store.h"
+#include "artifact.h"
+#include "avatar.h"
 
 
 /*
@@ -144,7 +149,7 @@ static bool z_older_than(byte x, byte y, byte z)
  * @details
  * Avoid the top two lines, to avoid interference with "msg_print()".
  */
-static void note(cptr msg)
+static void note(concptr msg)
 {
        static TERM_LEN y = 2;
 
@@ -871,7 +876,10 @@ static void rd_monster_old(monster_type *m_ptr)
        }
        
        rd_s16b(&m_ptr->mtimed[MTIMED_CSLEEP]);
-       rd_byte(&m_ptr->mspeed);
+
+       rd_byte(&tmp8u);
+       m_ptr->mspeed = tmp8u;
+
        if (z_older_than(10, 4, 2))
        {
                rd_byte(&tmp8u);
@@ -1025,7 +1033,8 @@ static void rd_monster(monster_type *m_ptr)
        if (flags & SAVE_MON_CSLEEP) rd_s16b(&m_ptr->mtimed[MTIMED_CSLEEP]);
        else m_ptr->mtimed[MTIMED_CSLEEP] = 0;
 
-       rd_byte(&m_ptr->mspeed);
+       rd_byte(&tmp8u);
+       m_ptr->mspeed = tmp8u;
 
        rd_s16b(&m_ptr->energy_need);
 
@@ -1661,9 +1670,12 @@ static void load_quick_start(void)
        }
 
        rd_byte(&previous_char.psex);
-       rd_byte(&previous_char.prace);
-       rd_byte(&previous_char.pclass);
-       rd_byte(&previous_char.pseikaku);
+       rd_byte(&tmp8u);
+       previous_char.prace = (RACE_IDX)tmp8u;
+       rd_byte(&tmp8u);
+       previous_char.pclass = (CLASS_IDX)tmp8u;
+       rd_byte(&tmp8u);
+       previous_char.pseikaku = (CHARACTER_IDX)tmp8u;
        rd_byte(&tmp8u);
        previous_char.realm1 = (REALM_IDX)tmp8u;
        rd_byte(&tmp8u);
@@ -1675,8 +1687,8 @@ static void load_quick_start(void)
        rd_s16b(&previous_char.sc);
        rd_s32b(&previous_char.au);
 
-       for (i = 0; i < 6; i++) rd_s16b(&previous_char.stat_max[i]);
-       for (i = 0; i < 6; i++) rd_s16b(&previous_char.stat_max_max[i]);
+       for (i = 0; i < A_MAX; i++) rd_s16b(&previous_char.stat_max[i]);
+       for (i = 0; i < A_MAX; i++) rd_s16b(&previous_char.stat_max_max[i]);
 
        for (i = 0; i < PY_MAX_LEVEL; i++)
        {
@@ -1731,9 +1743,12 @@ static void rd_extra(void)
        }
 
        /* Class/Race/Seikaku/Gender/Spells */
-       rd_byte(&p_ptr->prace);
-       rd_byte(&p_ptr->pclass);
-       rd_byte(&p_ptr->pseikaku);
+       rd_byte(&tmp8u);
+       p_ptr->prace = (RACE_IDX)tmp8u;
+       rd_byte(&tmp8u);
+       p_ptr->pclass = (CLASS_IDX)tmp8u;
+       rd_byte(&tmp8u);
+       p_ptr->pseikaku = (CHARACTER_IDX)tmp8u;
        rd_byte(&p_ptr->psex);
        rd_byte(&tmp8u);
        p_ptr->realm1 = (REALM_IDX)tmp8u;
@@ -1760,9 +1775,9 @@ static void rd_extra(void)
        rd_s16b(&p_ptr->wt);
 
        /* Read the stat info */
-       for (i = 0; i < 6; i++) rd_s16b(&p_ptr->stat_max[i]);
-       for (i = 0; i < 6; i++) rd_s16b(&p_ptr->stat_max_max[i]);
-       for (i = 0; i < 6; i++) rd_s16b(&p_ptr->stat_cur[i]);
+       for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_max[i]);
+       for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_max_max[i]);
+       for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_cur[i]);
 
        strip_bytes(24);
        rd_s32b(&p_ptr->au);
@@ -1830,7 +1845,8 @@ static void rd_extra(void)
        }
        else
        {
-               rd_byte(&p_ptr->start_race);
+               rd_byte(&tmp8u);
+               p_ptr->start_race = (RACE_IDX)tmp8u;
                rd_s32b(&tmp32s);
                p_ptr->old_race1 = (BIT_FLAGS)tmp32s;
                rd_s32b(&tmp32s);
@@ -2407,10 +2423,7 @@ static errr rd_inventory(void)
                /* Wield equipment */
                if (n >= INVEN_RARM)
                {
-                       /* Player touches it */
                        q_ptr->marked |= OM_TOUCHED;
-
-                       /* Copy object */
                        object_copy(&inventory[n], q_ptr);
 
                        /* Add the weight */
@@ -2435,10 +2448,7 @@ static errr rd_inventory(void)
                        /* Get a slot */
                        n = slot++;
 
-                       /* Player touches it */
                        q_ptr->marked |= OM_TOUCHED;
-
-                       /* Copy object */
                        object_copy(&inventory[n], q_ptr);
 
                        /* Add the weight */