OSDN Git Service

#37287 #37353 (2.2.0.89) 型の置換を継続中。 / Ongoing type replacement.
[hengband/hengband.git] / src / bldg.c
index a134ffc..7d77228 100644 (file)
@@ -1438,10 +1438,10 @@ static bool gamble_comm(int cmd)
  * 自爆以外のなんらかのHP攻撃手段を持っていること。
  * @return 参加できるか否か
  */
-static bool vault_aux_battle(int r_idx)
+static bool vault_aux_battle(MONRACE_IDX r_idx)
 {
        int i;
-       int dam = 0;
+       HIT_POINT dam = 0;
 
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1501,9 +1501,10 @@ void battle_monsters(void)
        {
                total = 0;
                tekitou = FALSE;
-               for(i=0;i<4;i++)
+               for(i = 0; i < 4; i++)
                {
-                       int r_idx, j;
+                       MONRACE_IDX r_idx;
+                       int j;
                        while (1)
                        {
                                get_mon_num_prep(vault_aux_battle, NULL);
@@ -1715,9 +1716,9 @@ static void today_target(void)
        c_put_str(TERM_YELLOW, _("本日の賞金首", "Wanted monster that changes from day to day"), 5, 10);
        sprintf(buf,_("ターゲット: %s", "target: %s"),r_name + r_ptr->name);
        c_put_str(TERM_YELLOW, buf, 6, 10);
-       sprintf(buf,_("死体 ---- $%d", "corpse   ---- $%d"),r_ptr->level * 50 + 100);
+       sprintf(buf,_("死体 ---- $%d", "corpse   ---- $%d"), (int)r_ptr->level * 50 + 100);
        prt(buf, 8, 10);
-       sprintf(buf,_("骨   ---- $%d", "skeleton ---- $%d"),r_ptr->level * 30 + 60);
+       sprintf(buf,_("骨   ---- $%d", "skeleton ---- $%d"), (int)r_ptr->level * 30 + 60);
        prt(buf, 9, 10);
        p_ptr->today_mon = today_mon;
 }
@@ -1785,8 +1786,8 @@ static void shoukinkubi(void)
  * 賞金首の報酬テーブル / List of prize object
  */
 static struct {
-       s16b tval; /*!< ベースアイテムのメイン種別ID */
-       s16b sval; /*!< ベースアイテムのサブ種別ID */
+       OBJECT_TYPE_VALUE tval; /*!< ベースアイテムのメイン種別ID */
+       OBJECT_SUBTYPE_VALUE sval; /*!< ベースアイテムのサブ種別ID */
 } prize_list[MAX_KUBI] = 
 {
        {TV_POTION, SV_POTION_CURING},
@@ -2026,7 +2027,7 @@ static bool kankin(void)
  * @param r_idx 判定対象となるモンスターのID
  * @return 悪夢の元凶となり得るか否か。
  */
-bool get_nightmare(int r_idx)
+bool get_nightmare(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2189,7 +2190,7 @@ static void get_questinfo(IDX questnum, bool do_init)
        p_ptr->inside_quest = old_quest;
 
        /* Print the quest info */
-       sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), quest[questnum].level);
+       sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
 
        prt(tmp_str, 5, 0);
 
@@ -2207,7 +2208,7 @@ static void get_questinfo(IDX questnum, bool do_init)
  */
 static void castle_quest(void)
 {
-       int             q_index = 0;
+       IDX q_index = 0;
        monster_race    *r_ptr;
        quest_type      *q_ptr;
        cptr            name;
@@ -2322,9 +2323,9 @@ static void town_history(void)
  * @return ダメージ期待値
  * @note 基本ダメージ量と重量はこの部位では計算に加わらない。
  */
-s16b calc_crit_ratio_shot(int plus_ammo, int plus_bow)
+HIT_POINT calc_crit_ratio_shot(HIT_POINT plus_ammo, HIT_POINT plus_bow)
 {
-       int i;
+       HIT_POINT i;
        object_type *j_ptr =  &inventory[INVEN_BOW];
        
        /* Extract "shot" power */
@@ -2355,7 +2356,7 @@ s16b calc_crit_ratio_shot(int plus_ammo, int plus_bow)
  * @param dam 基本ダメージ量
  * @return ダメージ期待値
  */
-s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  int dam)
+HIT_POINT calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  HIT_POINT dam)
 {
        u32b num;
        int i, k, crit;
@@ -2397,7 +2398,7 @@ s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  int dam)
  * @param dokubari 毒針処理か否か
  * @return ダメージ期待値
  */
-s16b calc_expect_crit(int weight, int plus, int dam, s16b meichuu, bool dokubari)
+HIT_POINT calc_expect_crit(int weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari)
 {
        u32b k, num;
        int i;
@@ -2441,7 +2442,7 @@ s16b calc_expect_crit(int weight, int plus, int dam, s16b meichuu, bool dokubari
  * @param force 理力特別計算フラグ
  * @return ダメージ期待値
  */
-static s16b calc_slaydam(int dam, int mult, int div, bool force)
+static HIT_POINT calc_slaydam(HIT_POINT dam, int mult, int div, bool force)
 {
        int tmp;
        if(force)
@@ -2870,7 +2871,7 @@ static bool item_tester_hook_ammo(object_type *o_ptr)
 static int compare_weapons(int bcost)
 {
        int i, n;
-       int item, item2;
+       OBJECT_IDX item, item2;
        object_type *o_ptr[2];
        object_type orig_weapon;
        object_type *i_ptr;
@@ -3183,7 +3184,7 @@ static void give_one_ability_of_object(object_type *to_ptr, object_type *from_pt
 static int repair_broken_weapon_aux(int bcost)
 {
        s32b cost;
-       int item, mater;
+       OBJECT_IDX item, mater;
        object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
        object_kind *k_ptr;
        int i, dd_bonus, ds_bonus;
@@ -3267,7 +3268,8 @@ static int repair_broken_weapon_aux(int bcost)
 
        if (o_ptr->sval == SV_BROKEN_DAGGER)
        {
-               int j, n = 1;
+               IDX j;
+               int n = 1;
 
                /* Suppress compiler warning */
                k_idx = 0;
@@ -3292,7 +3294,7 @@ static int repair_broken_weapon_aux(int bcost)
        else /* TV_BROKEN_SWORD */
        {
                /* Repair to a sword or sometimes material's type weapon */
-               int tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
+               OBJECT_TYPE_VALUE tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
 
                while(1)
                {
@@ -3342,7 +3344,7 @@ static int repair_broken_weapon_aux(int bcost)
        /* Copy base object's ability */
        for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
        if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
-       if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = k_ptr->act_idx;
+       if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = (byte_hack)k_ptr->act_idx;
 
        /* Dice up */
        if (dd_bonus > 0)
@@ -3456,7 +3458,8 @@ static int repair_broken_weapon(int bcost)
  */
 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
 {
-       int         i, item;
+       int         i;
+       OBJECT_IDX  item;
        bool        okay = FALSE;
        object_type *o_ptr;
        cptr        q, s;
@@ -3574,12 +3577,13 @@ static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
  */
 static void building_recharge(void)
 {
-       int         item, lev;
+       OBJECT_IDX  item;
+       int         lev;
        object_type *o_ptr;
        object_kind *k_ptr;
        cptr        q, s;
        int         price;
-       int         charges;
+       PARAMETER_VALUE charges;
        int         max_charges;
        char        tmp_str[MAX_NLEN];
 
@@ -4018,7 +4022,9 @@ bool tele_town(void)
  */
 static bool research_mon(void)
 {
-       int i, n, r_idx;
+       IDX i;
+       int n;
+       MONRACE_IDX r_idx;
        char sym, query;
        char buf[128];
 
@@ -4028,7 +4034,7 @@ static bool research_mon(void)
 
        u16b why = 0;
 
-       u16b    *who;
+       IDX *who;
 
        /* XTRA HACK WHATSEARCH */
        bool    all = FALSE;
@@ -4038,7 +4044,7 @@ static bool research_mon(void)
 
        /* XTRA HACK REMEMBER_IDX */
        static int old_sym = '\0';
-       static int old_i = 0;
+       static IDX old_i = 0;
 
 
        /* Save the screen */
@@ -4105,7 +4111,7 @@ static bool research_mon(void)
 
 
        /* Allocate the "who" array */
-       C_MAKE(who, max_r_idx, u16b);
+       C_MAKE(who, max_r_idx, IDX);
 
        /* Collect matching monsters */
        for (n = 0, i = 1; i < max_r_idx; i++)
@@ -4137,7 +4143,7 @@ static bool research_mon(void)
                                        continue;
                                }
 #endif
-                               if (isupper(temp[xx])) temp[xx] = tolower(temp[xx]);
+                               if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
                        }
   
 #ifdef JP
@@ -4146,7 +4152,7 @@ static bool research_mon(void)
                        strcpy(temp2, r_name + r_ptr->name);
 #endif
                        for (xx = 0; temp2[xx] && xx < 80; xx++)
-                               if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
+                               if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
 
 #ifdef JP
                        if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
@@ -4162,7 +4168,7 @@ static bool research_mon(void)
        if (!n)
        {
                /* Free the "who" array */
-               C_KILL(who, max_r_idx, u16b);
+               C_KILL(who, max_r_idx, IDX);
 
                /* Restore */
                screen_load();
@@ -4270,7 +4276,7 @@ static bool research_mon(void)
        /* prt(buf, 5, 5);*/
 
        /* Free the "who" array */
-       C_KILL(who, max_r_idx, u16b);
+       C_KILL(who, max_r_idx, IDX);
 
        /* Restore */
        screen_load();
@@ -4428,8 +4434,8 @@ static void bldg_process_command(building_type *bldg, int i)
                break;
        case BACT_TELEPORT_LEVEL:
        {
-               int select_dungeon;
-               int max_depth;
+               IDX select_dungeon;
+               DEPTH max_depth;
 
                clear_bldg(4, 20);
                select_dungeon = choose_dungeon(_("にテレポート", "teleport"), 4, 0);
@@ -4802,7 +4808,7 @@ void quest_discovery(int q_idx)
  */
 IDX quest_number(DEPTH level)
 {
-       int i;
+       IDX i;
 
        /* Check quests */
        if (p_ptr->inside_quest)
@@ -4830,16 +4836,16 @@ IDX quest_number(DEPTH level)
  */
 IDX random_quest_number(DEPTH level)
 {
-       int i;
+       IDX i;
 
        if (dungeon_type != DUNGEON_ANGBAND) return 0;
 
        for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
        {
                if ((quest[i].type == QUEST_TYPE_RANDOM) &&
-                   (quest[i].status == QUEST_STATUS_TAKEN) &&
-                   (quest[i].level == level) &&
-                   (quest[i].dungeon == DUNGEON_ANGBAND))
+                       (quest[i].status == QUEST_STATUS_TAKEN) &&
+                       (quest[i].level == level) &&
+                       (quest[i].dungeon == DUNGEON_ANGBAND))
                {
                        return i;
                }