OSDN Git Service

#37287 #37353 (2.2.0.89) BIT_FLAGS型を定義し、型の置換を継続中。 / Define BIT_FLAGS, ongoing type...
[hengband/hengband.git] / src / init1.c
index f3b4c60..44b7612 100644 (file)
@@ -424,10 +424,10 @@ static cptr r_info_flags4[] =
 };
 
 /*!
- * モンスター特性トークンの定義5 /
+ * モンスター特性トークン(発動型能力1) /
  * Monster race flags
  */
-static cptr r_info_flags5[] =
+static cptr r_a_ability_flags1[] =
 {
        "BA_ACID",
        "BA_ELEC",
@@ -464,10 +464,10 @@ static cptr r_info_flags5[] =
 };
 
 /*!
- * モンスター特性トークンの定義6 /
+ * モンスター特性トークン(発動型能力2) /
  * Monster race flags
  */
-static cptr r_info_flags6[] =
+static cptr r_a_ability_flags2[] =
 {
        "HASTE",
        "HAND_DOOM",
@@ -503,6 +503,86 @@ static cptr r_info_flags6[] =
        "S_UNIQUE"
 };
 
+/*!
+ * モンスター特性トークン(発動型能力3) /
+ * Monster race flags
+ */
+static cptr r_a_ability_flags3[] =
+{
+       "XXXA3X00",
+       "XXXA3X01",
+       "XXXA3X02",
+       "XXXA3X03",
+       "XXXA3X04",
+       "XXXA3X05",
+       "XXXA3X06",
+       "XXXA3X07",
+       "XXXA3X08",
+       "XXXA3X09",
+       "XXXA3X10",
+       "XXXA3X11",
+       "XXXA3X12",
+       "XXXA3X13",
+       "XXXA3X14",
+       "XXXA3X15",
+       "XXXA3X16",
+       "XXXA3X17",
+       "XXXA3X18",
+       "XXXA3X19",
+       "XXXA3X20",
+       "XXXA3X21",
+       "XXXA3X22",
+       "XXXA3X23",
+       "XXXA3X24",
+       "XXXA3X25",
+       "XXXA3X26",
+       "XXXA3X27",
+       "XXXA3X28",
+       "XXXA3X29",
+       "XXXA3X30",
+       "XXXA3X31",
+};
+
+/*!
+ * モンスター特性トークン(発動型能力4) /
+ * Monster race flags
+ */
+static cptr r_a_ability_flags4[] =
+{
+       "XXXA4X00",
+       "XXXA4X01",
+       "XXXA4X02",
+       "XXXA4X03",
+       "XXXA4X04",
+       "XXXA4X05",
+       "XXXA4X06",
+       "XXXA4X07",
+       "XXXA4X08",
+       "XXXA4X09",
+       "XXXA4X10",
+       "XXXA4X11",
+       "XXXA4X12",
+       "XXXA4X13",
+       "XXXA4X14",
+       "XXXA4X15",
+       "XXXA4X16",
+       "XXXA4X17",
+       "XXXA4X18",
+       "XXXA4X19",
+       "XXXA4X20",
+       "XXXA4X21",
+       "XXXA4X22",
+       "XXXA4X23",
+       "XXXA4X24",
+       "XXXA4X25",
+       "XXXA4X26",
+       "XXXA4X27",
+       "XXXA4X28",
+       "XXXA4X29",
+       "XXXA4X30",
+       "XXXA4X31",
+};
+
 
 /*!
  * モンスター特性トークンの定義7 /
@@ -2162,7 +2242,6 @@ errr parse_k_info(char *buf, header *head)
        /* Process 'A' for "Allocation" (one line only) */
        else if (buf[0] == 'A')
        {
-               int i;
 
                /* XXX XXX XXX Simply read each number following a colon */
                for (i = 0, s = buf+1; s && (s[0] == ':') && s[1]; ++i)
@@ -2635,7 +2714,7 @@ errr parse_e_info(char *buf, header *head)
 
                /* Save the values */
                e_ptr->level = level;
-               e_ptr->rarity = rarity;
+               e_ptr->rarity = (RARITY)rarity;
                /* e_ptr->weight = wgt; */
                e_ptr->cost = cost;
        }
@@ -2643,16 +2722,16 @@ errr parse_e_info(char *buf, header *head)
        /* Hack -- Process 'C' for "creation" */
        else if (buf[0] == 'C')
        {
-               int th, td, ta, pv;
+               int th, td, ta, pval;
 
                /* Scan for the values */
                if (4 != sscanf(buf+2, "%d:%d:%d:%d",
-                               &th, &td, &ta, &pv)) return (1);
+                               &th, &td, &ta, &pval)) return (1);
 
                e_ptr->max_to_h = th;
                e_ptr->max_to_d = td;
                e_ptr->max_to_a = ta;
-               e_ptr->max_pval = pv;
+               e_ptr->max_pval = (PARAMETER_VALUE)pval;
        }
 
        /* Hack -- Process 'U' for activation index */
@@ -2752,10 +2831,10 @@ static errr grab_one_spell_flag(monster_race *r_ptr, cptr what)
        if (grab_one_flag(&r_ptr->flags4, r_info_flags4, what) == 0)
                return 0;
 
-       if (grab_one_flag(&r_ptr->flags5, r_info_flags5, what) == 0)
+       if (grab_one_flag(&r_ptr->a_ability_flags1, r_a_ability_flags1, what) == 0)
                return 0;
 
-       if (grab_one_flag(&r_ptr->flags6, r_info_flags6, what) == 0)
+       if (grab_one_flag(&r_ptr->a_ability_flags2, r_a_ability_flags2, what) == 0)
                return 0;
 
        /* Oops */
@@ -2919,12 +2998,12 @@ errr parse_r_info(char *buf, header *head)
                                &lev, &rar, &pad, &exp, &nextexp, &nextmon)) return (1);
 
                /* Save the values */
-               r_ptr->level = lev;
-               r_ptr->rarity = rar;
+               r_ptr->level = (DEPTH)lev;
+               r_ptr->rarity = (RARITY)rar;
                r_ptr->extra = pad;
                r_ptr->mexp = exp;
                r_ptr->next_exp = nextexp;
-               r_ptr->next_r_idx = nextmon;
+               r_ptr->next_r_idx = (IDX)nextmon;
        }
 
        /* Process 'R' for "Reinforcement" (up to six lines) */
@@ -3076,7 +3155,7 @@ errr parse_r_info(char *buf, header *head)
 
                if (3 != sscanf(buf+2, "%d:%d:%d", &id, &rarity, &per)) return (1);
                r_ptr->artifact_id[i] = id;
-               r_ptr->artifact_rarity[i] = rarity;
+               r_ptr->artifact_rarity[i] = (RARITY)rarity;
                r_ptr->artifact_percent[i] = per;
        }
 
@@ -3085,7 +3164,7 @@ errr parse_r_info(char *buf, header *head)
        {
                int val;
                if (3 != sscanf(buf+2, "%d", &val)) return (1);
-               r_ptr->arena_ratio = val;
+               r_ptr->arena_ratio = (PERCENTAGE)val;
        }
 
        /* Oops */
@@ -3165,10 +3244,10 @@ static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what)
        if (grab_one_flag(&d_ptr->mflags4, r_info_flags4, what) == 0)
                return 0;
 
-       if (grab_one_flag(&d_ptr->mflags5, r_info_flags5, what) == 0)
+       if (grab_one_flag(&d_ptr->m_a_ability_flags1, r_a_ability_flags1, what) == 0)
                return 0;
 
-       if (grab_one_flag(&d_ptr->mflags6, r_info_flags6, what) == 0)
+       if (grab_one_flag(&d_ptr->m_a_ability_flags2, r_a_ability_flags2, what) == 0)
                return 0;
 
        /* Oops */
@@ -3533,12 +3612,12 @@ typedef struct dungeon_grid dungeon_grid;
 
 struct dungeon_grid
 {
-       int             feature;                /* Terrain feature */
-       int             monster;                /* Monster */
-       int             object;                 /* Object */
-       int             ego;                    /* Ego-Item */
-       int             artifact;               /* Artifact */
-       int             trap;                   /* Trap */
+       IDX             feature;                /* Terrain feature */
+       IDX             monster;                /* Monster */
+       IDX             object;                 /* Object */
+       IDX             ego;                    /* Ego-Item */
+       IDX             artifact;               /* Artifact */
+       IDX             trap;                   /* Trap */
        int             cave_info;              /* Flags for CAVE_MARK, CAVE_GLOW, CAVE_ICKY, CAVE_ROOM */
        int             special;                /* Reserved for special terrain info */
        int             random;                 /* Number of the random effect */
@@ -3956,10 +4035,10 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
 
                        int idx = s[0];
 
-                       int object_index = letter[idx].object;
-                       int monster_index = letter[idx].monster;
+                       IDX object_index = letter[idx].object;
+                       IDX monster_index = letter[idx].monster;
                        int random = letter[idx].random;
-                       int artifact_index = letter[idx].artifact;
+                       IDX artifact_index = letter[idx].artifact;
 
                        /* Lay down a floor */
                        c_ptr->feat = conv_dungeon_feat(letter[idx].feature);
@@ -4093,7 +4172,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        {
                                if (a_info[artifact_index].cur_num)
                                {
-                                       int k_idx = lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
+                                       IDX k_idx = lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
                                        object_type forge;
                                        object_type *q_ptr = &forge;
 
@@ -4155,8 +4234,8 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                q_ptr->cur_num = atoi(zz[4]);
                                q_ptr->max_num = atoi(zz[5]);
                                q_ptr->level   = atoi(zz[6]);
-                               q_ptr->r_idx   = atoi(zz[7]);
-                               q_ptr->k_idx   = atoi(zz[8]);
+                               q_ptr->r_idx   = (IDX)atoi(zz[7]);
+                               q_ptr->k_idx   = (IDX)atoi(zz[8]);
                                q_ptr->dungeon = atoi(zz[9]);
 
                                if (num > 10)
@@ -4176,12 +4255,12 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                {
                        if (init_flags & INIT_ASSIGN)
                        {
-                               int idx, count = 0;
-                               int reward_idx = 0;
+                               int count = 0;
+                               IDX idx, reward_idx = 0;
 
                                for (idx = 2; idx < num; idx++)
                                {
-                                       int a_idx = atoi(zz[idx]);
+                                       IDX a_idx = (IDX)atoi(zz[idx]);
                                        if (a_idx < 1) continue;
                                        if (a_info[a_idx].cur_num > 0) continue;
                                        count++;
@@ -4259,16 +4338,16 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                /* Place player in a quest level */
                                if (p_ptr->inside_quest)
                                {
-                                       int y, x;
+                                       int py, px;
 
                                        /* Delete the monster (if any) */
                                        delete_monster(p_ptr->y, p_ptr->x);
 
-                                       y = atoi(zz[0]);
-                                       x = atoi(zz[1]);
+                                       py = atoi(zz[0]);
+                                       px = atoi(zz[1]);
 
-                                       p_ptr->y = y;
-                                       p_ptr->x = x;
+                                       p_ptr->y = py;
+                                       p_ptr->x = px;
                                }
                                /* Place player in the town */
                                else if (!p_ptr->oldpx && !p_ptr->oldpy)
@@ -4296,67 +4375,67 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        /* Maximum towns */
                        if (zz[0][0] == 'T')
                        {
-                               max_towns = atoi(zz[1]);
+                               max_towns = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum quests */
                        else if (zz[0][0] == 'Q')
                        {
-                               max_quests = atoi(zz[1]);
+                               max_quests = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum r_idx */
                        else if (zz[0][0] == 'R')
                        {
-                               max_r_idx = atoi(zz[1]);
+                               max_r_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum k_idx */
                        else if (zz[0][0] == 'K')
                        {
-                               max_k_idx = atoi(zz[1]);
+                               max_k_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum v_idx */
                        else if (zz[0][0] == 'V')
                        {
-                               max_v_idx = atoi(zz[1]);
+                               max_v_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum f_idx */
                        else if (zz[0][0] == 'F')
                        {
-                               max_f_idx = atoi(zz[1]);
+                               max_f_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum a_idx */
                        else if (zz[0][0] == 'A')
                        {
-                               max_a_idx = atoi(zz[1]);
+                               max_a_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum e_idx */
                        else if (zz[0][0] == 'E')
                        {
-                               max_e_idx = atoi(zz[1]);
+                               max_e_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum d_idx */
                        else if (zz[0][0] == 'D')
                        {
-                               max_d_idx = atoi(zz[1]); 
+                               max_d_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum o_idx */
                        else if (zz[0][0] == 'O')
                        {
-                               max_o_idx = atoi(zz[1]);
+                               max_o_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum m_idx */
                        else if (zz[0][0] == 'M')
                        {
-                               max_m_idx = atoi(zz[1]);
+                               max_m_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Wilderness size */
@@ -4882,8 +4961,8 @@ void write_r_info_txt(void)
                f_ptr[1] = r_ptr->flags2; n_ptr[1] = r_info_flags2;
                f_ptr[2] = r_ptr->flags3; n_ptr[2] = r_info_flags3;
                f_ptr[3] = r_ptr->flags4; n_ptr[3] = r_info_flags4;
-               f_ptr[4] = r_ptr->flags5; n_ptr[4] = r_info_flags5;
-               f_ptr[5] = r_ptr->flags6; n_ptr[5] = r_info_flags6;
+               f_ptr[4] = r_ptr->a_ability_flags1; n_ptr[4] = r_a_ability_flags1;
+               f_ptr[5] = r_ptr->a_ability_flags2; n_ptr[5] = r_a_ability_flags2;
                f_ptr[6] = r_ptr->flags7; n_ptr[6] = r_info_flags7;
                f_ptr[7] = r_ptr->flags8; n_ptr[7] = r_info_flags8;
                f_ptr[8] = r_ptr->flags9; n_ptr[8] = r_info_flags9;