X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Finit1.c;h=998e1884546d1d70cebea27171a1bdcdad12ff37;hb=6cf96c6b1c3341ee94382b482f969b4b7f9d5858;hp=b6df92e557b2f39427db8b8c540296061568a897;hpb=4a6d061a5fbd1b3d68d73d48d5afe4f201f8cef0;p=hengband%2Fhengband.git diff --git a/src/init1.c b/src/init1.c index b6df92e55..998e18845 100644 --- a/src/init1.c +++ b/src/init1.c @@ -1603,7 +1603,7 @@ static errr grab_one_feat_flag(feature_type *f_ptr, cptr what) */ static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count) { - int i; + FF_FLAGS_IDX i; /* Check flags */ for (i = 0; i < FF_FLAG_MAX; i++) @@ -1675,10 +1675,10 @@ errr parse_f_info(char *buf, header *head) } /* Default "mimic" */ - f_ptr->mimic = (IDX)i; + f_ptr->mimic = (FEAT_IDX)i; /* Default "destroyed state" -- if not specified */ - f_ptr->destroyed = (IDX)i; + f_ptr->destroyed = (FEAT_IDX)i; /* Default "states" */ for (i = 0; i < MAX_FEAT_STATES; i++) f_ptr->state[i].action = FF_FLAG_MAX; @@ -1723,7 +1723,7 @@ errr parse_f_info(char *buf, header *head) if (!add_tag(&offset, head, buf + 2)) return PARSE_ERROR_OUT_OF_MEMORY; /* Record a fake tag index */ - f_ptr->mimic = -offset; + f_ptr->mimic_tag = offset; } @@ -1821,7 +1821,7 @@ errr parse_f_info(char *buf, header *head) if (1 == sscanf(s, "SUBTYPE_%d", &i)) { /* Extract a "subtype" */ - f_ptr->subtype = i; + f_ptr->subtype = (FEAT_SUBTYPE)i; /* Start at next entry */ s = t; @@ -1860,7 +1860,7 @@ errr parse_f_info(char *buf, header *head) if (1 != sscanf(buf+2, "%d", &priority)) return (PARSE_ERROR_GENERIC); /* Save the value */ - f_ptr->priority = priority; + f_ptr->priority = (FEAT_PRIORITY)priority; } /* Process 'K' for "States" (up to four lines + default (which cannot be last)) */ @@ -1886,7 +1886,7 @@ errr parse_f_info(char *buf, header *head) if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY; /* Record a fake tag index */ - f_ptr->destroyed = -offset; + f_ptr->destroyed_tag = offset; } else { @@ -1899,12 +1899,12 @@ errr parse_f_info(char *buf, header *head) if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY; /* Record a fake tag index */ - f_ptr->state[i].result = -offset; + f_ptr->state[i].result_tag = offset; } } /* Oops */ - else return (6); + else return (6); /* Success */ return (0); @@ -1939,29 +1939,32 @@ s16b f_tag_to_index(cptr str) /*! * @brief 地形タグからIDを得る / * Search for real index corresponding to this fake tag - * @param feat タグ文字列 - * @return なし + * @param feat タグ文字列のオフセット + * @return 地形ID。該当がないなら-1 */ -static void search_real_feat(s16b *feat) +static FEAT_IDX search_real_feat(STR_OFFSET feat) { - int i; + FEAT_IDX i; /* Don't convert non-fake tag */ - if (*feat >= 0) return; + if (feat <= 0) + { + return -1; + } /* Search for real index corresponding to this fake tag */ for (i = 0; i < f_head.info_num; i++) { - if ((-(*feat)) == f_info[i].tag) + if (feat == f_info[i].tag) { /* Record real index */ - *feat = (s16b)i; - return; + return i; } } /* Undefined tag */ - msg_format(_("未定義のタグ '%s'。", "%s is undefined."), f_tag + (-(*feat))); + msg_format(_("未定義のタグ '%s'。", "%s is undefined."), f_tag + feat); + return -1; } @@ -1979,13 +1982,17 @@ void retouch_f_info(header *head) for (i = 0; i < head->info_num; i++) { feature_type *f_ptr = &f_info[i]; - int j; - - search_real_feat(&f_ptr->mimic); + FEAT_IDX j, k; - search_real_feat(&f_ptr->destroyed); - - for (j = 0; j < MAX_FEAT_STATES; j++) search_real_feat(&f_ptr->state[j].result); + k = search_real_feat(f_ptr->mimic_tag); + f_ptr->mimic = k < 0 ? f_ptr->mimic : k; + k = search_real_feat(f_ptr->destroyed_tag); + f_ptr->destroyed = k < 0 ? f_ptr->destroyed : k; + for (j = 0; j < MAX_FEAT_STATES; j++) + { + k = search_real_feat(f_ptr->state[j].result_tag); + f_ptr->state[j].result = k < 0 ? f_ptr->state[j].result : k; + } } } @@ -2234,7 +2241,7 @@ errr parse_k_info(char *buf, header *head) /* Save the values */ k_ptr->level = (DEPTH)level; - k_ptr->extra = extra; + k_ptr->extra = (BIT_FLAGS8)extra; k_ptr->weight = (WEIGHT)wgt; k_ptr->cost = (PRICE)cost; } @@ -2262,7 +2269,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; } } } @@ -2698,8 +2705,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) */ @@ -3000,7 +3007,7 @@ 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->extra = (BIT_FLAGS16)pad; r_ptr->mexp = (EXP)exp; r_ptr->next_exp = (EXP)nextexp; r_ptr->next_r_idx = (IDX)nextmon; @@ -3071,10 +3078,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); @@ -3358,7 +3365,7 @@ errr parse_d_info(char *buf, header *head) 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->mode = (BIT_FLAGS8)mode; d_ptr->min_m_alloc_level = min_alloc; d_ptr->max_m_alloc_chance = max_chance; d_ptr->obj_good = obj_good; @@ -3490,7 +3497,7 @@ errr parse_d_info(char *buf, header *head) if (1 == sscanf(s, "MONSTER_DIV_%d", &monst)) { /* Extract a "Special %" */ - d_ptr->special_div = monst; + d_ptr->special_div = (PROB)monst; /* Start at next entry */ s = t; @@ -3848,19 +3855,19 @@ static errr parse_line_building(char *buf) strcpy(building[index].act_names[action_index], zz[1]); /* Cost of the action for members */ - building[index].member_costs[action_index] = atoi(zz[2]); + building[index].member_costs[action_index] = (PRICE)atoi(zz[2]); /* Cost of the action for non-members */ - building[index].other_costs[action_index] = atoi(zz[3]); + building[index].other_costs[action_index] = (PRICE)atoi(zz[3]); /* Letter assigned to the action */ building[index].letters[action_index] = zz[4][0]; /* Action code */ - building[index].actions[action_index] = atoi(zz[5]); + building[index].actions[action_index] = (BACT_IDX)atoi(zz[5]); /* Action restriction */ - building[index].action_restr[action_index] = atoi(zz[6]); + building[index].action_restr[action_index] = (BACT_RESTRICT_IDX)atoi(zz[6]); break; } @@ -3875,7 +3882,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 +3898,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 +3914,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,17 +4236,16 @@ 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]); + if (num > 10) q_ptr->flags = atoi(zz[10]); r_ptr = &r_info[q_ptr->r_idx]; if (r_ptr->flags1 & RF1_UNIQUE) @@ -4910,7 +4916,7 @@ void write_r_info_txt(void) cptr desc; - int mode = -1; + BIT_FLAGS mode = -1; if (!fff) return;