OSDN Git Service

#37287 (2.2.0.89) C4701警告に対応。 / Fix C4701 warning.
[hengband/hengband.git] / src / init1.c
index 4996e97..14a1027 100644 (file)
@@ -1089,7 +1089,7 @@ static bool add_name(u32b *offset, header *head, cptr buf)
  * Returns FALSE when there isn't enough space available to store
  * the text.
  */
-static bool add_tag(s16b *offset, header *head, cptr buf)
+static bool add_tag(STR_OFFSET *offset, header *head, cptr buf)
 {
        u32b i;
 
@@ -1307,10 +1307,10 @@ errr parse_v_info(char *buf, header *head)
                        &typ, &rat, &hgt, &wid)) return (1);
 
                /* Save the values */
-               v_ptr->typ = typ;
-               v_ptr->rat = rat;
-               v_ptr->hgt = hgt;
-               v_ptr->wid = wid;
+               v_ptr->typ = (ROOM_IDX)typ;
+               v_ptr->rat = (PROB)rat;
+               v_ptr->hgt = (POSITION)hgt;
+               v_ptr->wid = (POSITION)wid;
        }
 
        /* Oops */
@@ -1718,7 +1718,7 @@ errr parse_f_info(char *buf, header *head)
        /* Process 'M' for "Mimic" (one line only) */
        else if (buf[0] == 'M')
        {
-               s16b offset;
+               STR_OFFSET offset;
 
                if (!add_tag(&offset, head, buf + 2)) return PARSE_ERROR_OUT_OF_MEMORY;
 
@@ -1834,7 +1834,7 @@ errr parse_f_info(char *buf, header *head)
                        if (1 == sscanf(s, "POWER_%d", &i))
                        {
                                /* Extract a "power" */
-                               f_ptr->power =  i;
+                               f_ptr->power = (FEAT_POWER)i;
 
                                /* Start at next entry */
                                s = t;
@@ -1866,7 +1866,7 @@ errr parse_f_info(char *buf, header *head)
        /* Process 'K' for "States" (up to four lines + default (which cannot be last)) */
        else if (buf[0] == 'K')
        {
-               s16b offset;
+               STR_OFFSET offset;
 
                /* Find the next empty state slot (if any) */
                for (i = 0; i < MAX_FEAT_STATES; i++) if (f_ptr->state[i].action == FF_FLAG_MAX) break;
@@ -2233,8 +2233,8 @@ errr parse_k_info(char *buf, header *head)
                                &level, &extra, &wgt, &cost)) return (1);
 
                /* Save the values */
-               k_ptr->level = level;
-               k_ptr->extra = extra;
+               k_ptr->level = (DEPTH)level;
+               k_ptr->extra = (BIT_FLAGS8)extra;
                k_ptr->weight = (WEIGHT)wgt;
                k_ptr->cost = (PRICE)cost;
        }
@@ -2262,7 +2262,7 @@ errr parse_k_info(char *buf, header *head)
                        if (t && (!s || t < s))
                        {
                                int chance = atoi(t+1);
-                               if (chance > 0) k_ptr->chance[i] = chance;
+                               if (chance > 0) k_ptr->chance[i] = (PROB)chance;
                        }
                }
        }
@@ -2474,9 +2474,9 @@ errr parse_a_info(char *buf, header *head)
                                &tval, &sval, &pval)) return (1);
 
                /* Save the values */
-               a_ptr->tval = tval;
-               a_ptr->sval = sval;
-               a_ptr->pval = pval;
+               a_ptr->tval = (OBJECT_TYPE_VALUE)tval;
+               a_ptr->sval = (OBJECT_SUBTYPE_VALUE)sval;
+               a_ptr->pval = (PARAMETER_VALUE)pval;
        }
 
        /* Process 'W' for "More Info" (one line only) */
@@ -2490,10 +2490,10 @@ errr parse_a_info(char *buf, header *head)
                                &level, &rarity, &wgt, &cost)) return (1);
 
                /* Save the values */
-               a_ptr->level = level;
-               a_ptr->rarity = rarity;
-               a_ptr->weight = wgt;
-               a_ptr->cost = cost;
+               a_ptr->level = (DEPTH)level;
+               a_ptr->rarity = (RARITY)rarity;
+               a_ptr->weight = (WEIGHT)wgt;
+               a_ptr->cost = (PRICE)cost;
        }
 
        /* Hack -- Process 'P' for "power" and such */
@@ -2505,12 +2505,12 @@ errr parse_a_info(char *buf, header *head)
                if (6 != sscanf(buf+2, "%d:%dd%d:%d:%d:%d",
                                &ac, &hd1, &hd2, &th, &td, &ta)) return (1);
 
-               a_ptr->ac = ac;
-               a_ptr->dd = hd1;
-               a_ptr->ds = hd2;
-               a_ptr->to_h = th;
-               a_ptr->to_d = td;
-               a_ptr->to_a =  ta;
+               a_ptr->ac = (ARMOUR_CLASS)ac;
+               a_ptr->dd = (DICE_NUMBER)hd1;
+               a_ptr->ds = (DICE_SID)hd2;
+               a_ptr->to_h = (HIT_PROB)th;
+               a_ptr->to_d = (HIT_POINT)td;
+               a_ptr->to_a = (ARMOUR_CLASS)ta;
        }
 
        /* Hack -- Process 'U' for activation index */
@@ -2698,8 +2698,8 @@ errr parse_e_info(char *buf, header *head)
                                &slot, &rating)) return (1);
 
                /* Save the values */
-               e_ptr->slot = slot;
-               e_ptr->rating = rating;
+               e_ptr->slot = (INVENTORY_IDX)slot;
+               e_ptr->rating = (PRICE)rating;
        }
 
        /* Process 'W' for "More Info" (one line only) */
@@ -2728,9 +2728,9 @@ errr parse_e_info(char *buf, header *head)
                if (4 != sscanf(buf+2, "%d:%d:%d:%d",
                                &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_to_h = (HIT_PROB)th;
+               e_ptr->max_to_d = (HIT_POINT)td;
+               e_ptr->max_to_a = (ARMOUR_CLASS)ta;
                e_ptr->max_pval = (PARAMETER_VALUE)pval;
        }
 
@@ -2980,9 +2980,9 @@ errr parse_r_info(char *buf, header *head)
                r_ptr->speed = (SPEED)spd;
                r_ptr->hdice = (DICE_NUMBER)MAX(hp1, 1);
                r_ptr->hside = (DICE_SID)MAX(hp2, 1);
-               r_ptr->aaf = aaf;
+               r_ptr->aaf = (POSITION)aaf;
                r_ptr->ac = (ARMOUR_CLASS)ac;
-               r_ptr->sleep = slp;
+               r_ptr->sleep = (SLEEP_DEGREE)slp;
        }
 
        /* Process 'W' for "More Info" (one line only) */
@@ -3000,9 +3000,9 @@ errr parse_r_info(char *buf, header *head)
                /* Save the values */
                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->extra = (BIT_FLAGS16)pad;
+               r_ptr->mexp = (EXP)exp;
+               r_ptr->next_exp = (EXP)nextexp;
                r_ptr->next_r_idx = (IDX)nextmon;
        }
 
@@ -3071,10 +3071,10 @@ errr parse_r_info(char *buf, header *head)
                if (*t == 'd') *t++ = '\0';
 
                /* Save the method */
-               r_ptr->blow[i].method = n1;
+               r_ptr->blow[i].method = (BLOW_METHOD)n1;
 
                /* Save the effect */
-               r_ptr->blow[i].effect = n2;
+               r_ptr->blow[i].effect = (BLOW_EFFECT)n2;
 
                /* Extract the damage dice and sides */
                r_ptr->blow[i].d_dice = atoi(s);
@@ -3355,16 +3355,16 @@ errr parse_d_info(char *buf, header *head)
                                 &min_lev, &max_lev, &min_plev, &mode, &min_alloc, &max_chance, &obj_good, &obj_great, (unsigned int *)&pit, (unsigned int *)&nest)) return (1);
 
                /* Save the values */
-               d_ptr->mindepth = min_lev;
-               d_ptr->maxdepth = max_lev;
-               d_ptr->min_plev = min_plev;
+               d_ptr->mindepth = (DEPTH)min_lev;
+               d_ptr->maxdepth = (DEPTH)max_lev;
+               d_ptr->min_plev = (PLAYER_LEVEL)min_plev;
                d_ptr->mode = mode;
                d_ptr->min_m_alloc_level = min_alloc;
                d_ptr->max_m_alloc_chance = max_chance;
                d_ptr->obj_good = obj_good;
                d_ptr->obj_great = obj_great;
-               d_ptr->pit = pit;
-               d_ptr->nest = nest;
+               d_ptr->pit = (BIT_FLAGS16)pit;
+               d_ptr->nest = (BIT_FLAGS16)nest;
        }
 
        /* Process 'P' for "Place Info" */
@@ -3394,7 +3394,7 @@ errr parse_d_info(char *buf, header *head)
                        d_ptr->floor[i].feat = f_tag_to_index(zz[i * 2]);
                        if (d_ptr->floor[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
 
-                       d_ptr->floor[i].percent = atoi(zz[i * 2 + 1]);
+                       d_ptr->floor[i].percent = (PERCENTAGE)atoi(zz[i * 2 + 1]);
                }
                d_ptr->tunnel_percent = atoi(zz[DUNGEON_FEAT_PROB_NUM * 2]);
        }
@@ -3413,7 +3413,7 @@ errr parse_d_info(char *buf, header *head)
                        d_ptr->fill[i].feat = f_tag_to_index(zz[i * 2]);
                        if (d_ptr->fill[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
 
-                       d_ptr->fill[i].percent = atoi(zz[i * 2 + 1]);
+                       d_ptr->fill[i].percent = (PERCENTAGE)atoi(zz[i * 2 + 1]);
                }
 
                d_ptr->outer_wall = f_tag_to_index(zz[DUNGEON_FEAT_PROB_NUM * 2]);
@@ -3451,7 +3451,7 @@ errr parse_d_info(char *buf, header *head)
                        if (1 == sscanf(s, "FINAL_ARTIFACT_%d", &artif))
                        {
                                /* Extract a "Final Artifact" */
-                               d_ptr->final_artifact = artif;
+                               d_ptr->final_artifact = (ARTIFACT_IDX)artif;
 
                                /* Start at next entry */
                                s = t;
@@ -3464,7 +3464,7 @@ errr parse_d_info(char *buf, header *head)
                        if (1 == sscanf(s, "FINAL_OBJECT_%d", &artif))
                        {
                                /* Extract a "Final Artifact" */
-                               d_ptr->final_object = artif;
+                               d_ptr->final_object = (KIND_OBJECT_IDX)artif;
 
                                /* Start at next entry */
                                s = t;
@@ -3477,7 +3477,7 @@ errr parse_d_info(char *buf, header *head)
                        if (1 == sscanf(s, "FINAL_GUARDIAN_%d", &monst))
                        {
                                /* Extract a "Artifact Guardian" */
-                               d_ptr->final_guardian = monst;
+                               d_ptr->final_guardian = (MONRACE_IDX)monst;
 
                                /* Start at next entry */
                                s = t;
@@ -3875,7 +3875,7 @@ static errr parse_line_building(char *buf)
                        {
                                for (i = 0; i < MAX_CLASS; i++)
                                {
-                                       building[index].member_class[i] = atoi(zz[i]);
+                                       building[index].member_class[i] = (CLASS_IDX)atoi(zz[i]);
                                }
 
                                break;
@@ -3891,7 +3891,7 @@ static errr parse_line_building(char *buf)
                        {
                                for (i = 0; i < MAX_RACES; i++)
                                {
-                                       building[index].member_race[i] = atoi(zz[i]);
+                                       building[index].member_race[i] = (RACE_IDX)atoi(zz[i]);
                                }
 
                                break;
@@ -3907,7 +3907,7 @@ static errr parse_line_building(char *buf)
                        {
                                for (i = 0; i < MAX_MAGIC; i++)
                                {
-                                       building[index].member_realm[i+1] = atoi(zz[i]);
+                                       building[index].member_realm[i+1] = (REALM_IDX)atoi(zz[i]);
                                }
 
                                break;
@@ -4229,14 +4229,14 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
 
                                if (num < 9) return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
 
-                               q_ptr->type    = atoi(zz[2]);
-                               q_ptr->num_mon = atoi(zz[3]);
-                               q_ptr->cur_num = atoi(zz[4]);
-                               q_ptr->max_num = atoi(zz[5]);
-                               q_ptr->level   = atoi(zz[6]);
+                               q_ptr->type    = (QUEST_TYPE)atoi(zz[2]);
+                               q_ptr->num_mon = (MONSTER_NUMBER)atoi(zz[3]);
+                               q_ptr->cur_num = (MONSTER_NUMBER)atoi(zz[4]);
+                               q_ptr->max_num = (MONSTER_NUMBER)atoi(zz[5]);
+                               q_ptr->level   = (DEPTH)atoi(zz[6]);
                                q_ptr->r_idx   = (IDX)atoi(zz[7]);
                                q_ptr->k_idx   = (IDX)atoi(zz[8]);
-                               q_ptr->dungeon = atoi(zz[9]);
+                               q_ptr->dungeon = (DUNGEON_IDX)atoi(zz[9]);
 
                                if (num > 10)
                                        q_ptr->flags  = atoi(zz[10]);