OSDN Git Service

#37287 #37353 (2.2.0.89) 型の置換を継続中。 / Ongoing type replacement.
[hengband/hengband.git] / src / object2.c
index 415352b..5e6fa91 100644 (file)
@@ -345,7 +345,8 @@ static void compact_objects_aux(IDX i1, IDX i2)
  */
 void compact_objects(int size)
 {
-       int i, y, x, num, cnt;
+       IDX i;
+       int y, x, num, cnt;
        int cur_lev, cur_dis, chance;
        object_type *o_ptr;
 
@@ -530,9 +531,9 @@ void wipe_o_list(void)
  * This routine should almost never fail, but in case it does,
  * we must be sure to handle "failure" of this routine.
  */
-s16b o_pop(void)
+IDX o_pop(void)
 {
-       int i;
+       IDX i;
 
 
        /* Initial allocation */
@@ -1854,11 +1855,11 @@ void object_absorb(object_type *o_ptr, object_type *j_ptr)
  * @param sval 検索したいベースアイテムのsval
  * @return なし
  */
-s16b lookup_kind(int tval, int sval)
+IDX lookup_kind(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval)
 {
-       int k;
+       IDX k;
        int num = 0;
-       int bk = 0;
+       IDX bk = 0;
 
        /* Look for it */
        for (k = 1; k < max_k_idx; k++)
@@ -1932,7 +1933,7 @@ void object_copy(object_type *o_ptr, object_type *j_ptr)
  * @param k_idx 新たに作成したいベースアイテム情報のID
  * @return なし
  */
-void object_prep(object_type *o_ptr, int k_idx)
+void object_prep(object_type *o_ptr, OBJECT_IDX k_idx)
 {
        object_kind *k_ptr = &k_info[k_idx];
 
@@ -2100,8 +2101,8 @@ static void object_mention(object_type *o_ptr)
  */
 static bool make_artifact_special(object_type *o_ptr)
 {
-       int i;
-       int k_idx = 0;
+       IDX i;
+       IDX k_idx = 0;
 
        /*! @note 地上ではキャンセルする / No artifacts in the town */
        if (!dun_level) return (FALSE);
@@ -2169,7 +2170,7 @@ static bool make_artifact_special(object_type *o_ptr)
  */
 static bool make_artifact(object_type *o_ptr)
 {
-       int i;
+       IDX i;
 
 
        /* No artifacts in the town */
@@ -3920,7 +3921,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
  * @param r_idx チェックしたいモンスター種族のID
  * @return 人形にできるならTRUEを返す
  */
-static bool item_monster_okay(int r_idx)
+static bool item_monster_okay(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -4074,7 +4075,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                case TV_FIGURINE:
                {
-                       int i = 1;
+                       PARAMETER_VALUE i = 1;
                        int check;
 
                        monster_race *r_ptr;
@@ -4113,7 +4114,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                case TV_CORPSE:
                {
-                       int i = 1;
+                       PARAMETER_VALUE i = 1;
                        int check;
 
                        u32b match = 0;
@@ -4163,7 +4164,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                case TV_STATUE:
                {
-                       int i = 1;
+                       PARAMETER_VALUE i = 1;
 
                        monster_race *r_ptr;
 
@@ -4194,7 +4195,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                case TV_CHEST:
                {
-                       byte obj_level = k_info[o_ptr->k_idx].level;
+                       DEPTH obj_level = k_info[o_ptr->k_idx].level;
 
                        /* Hack -- skip ruined chests */
                        if (obj_level <= 0) break;
@@ -4249,7 +4250,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
  * "good" and "great" arguments are false.  As a total hack, if "great" is\n
  * true, then the item gets 3 extra "attempts" to become an artifact.\n
  */
-void apply_magic(object_type *o_ptr, int lev, u32b mode)
+void apply_magic(object_type *o_ptr, DEPTH lev, BIT_FLAGS mode)
 {
        int i, rolls, f1, f2, power;
 
@@ -4660,7 +4661,7 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
  * @param k_idx 判定したいベースアイテムのID
  * @return ベースアイテムが上質ならばTRUEを返す。
  */
-static bool kind_is_good(int k_idx)
+static bool kind_is_good(KIND_OBJECT_IDX k_idx)
 {
        object_kind *k_ptr = &k_info[k_idx];
 
@@ -4751,10 +4752,10 @@ static bool kind_is_good(int k_idx)
  * This routine uses "object_level" for the "generation level".\n
  * We assume that the given object has been "wiped".\n
  */
-bool make_object(object_type *j_ptr, u32b mode)
+bool make_object(object_type *j_ptr, BIT_FLAGS mode)
 {
        int prob, base;
-       byte obj_level;
+       DEPTH obj_level;
 
 
        /* Chance of "special object" */
@@ -4767,7 +4768,7 @@ bool make_object(object_type *j_ptr, u32b mode)
        /* Generate a special object, or a normal object */
        if (!one_in_(prob) || !make_artifact_special(j_ptr))
        {
-               int k_idx;
+               IDX k_idx;
 
                /* Good objects */
                if ((mode & AM_GOOD) && !get_obj_num_hook)
@@ -4837,7 +4838,7 @@ bool make_object(object_type *j_ptr, u32b mode)
  * This routine uses "object_level" for the "generation level".\n
  * This routine requires a clean floor grid destination.\n
  */
-void place_object(POSITION y, POSITION x, u32b mode)
+void place_object(POSITION y, POSITION x, BIT_FLAGS mode)
 {
        IDX o_idx;
 
@@ -5454,8 +5455,8 @@ void acquirement(int y1, int x1, int num, bool great, bool special, bool known)
 
 typedef struct
 {
-       int tval;
-       int sval;
+       OBJECT_TYPE_VALUE tval;
+       OBJECT_SUBTYPE_VALUE sval;
        int prob;
        byte flag;
 } amuse_type;
@@ -5501,7 +5502,8 @@ void amusement(int y1, int x1, int num, bool known)
        /* Acquirement */
        while (num)
        {
-               int i, k_idx, a_idx = 0;
+               int i;
+               IDX k_idx, a_idx = 0;
                int r = randint0(t);
                bool insta_art, fixed_art;
 
@@ -6152,8 +6154,8 @@ bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr)
  */
 s16b inven_carry(object_type *o_ptr)
 {
-       int i, j, k;
-       int n = -1;
+       INVENTORY_IDX i, j, k;
+       INVENTORY_IDX n = -1;
 
        object_type *j_ptr;
 
@@ -6619,14 +6621,14 @@ void reorder_pack(void)
  * @details
  * Include list of usable spells for readible books
  */
-void display_koff(int k_idx)
+void display_koff(IDX k_idx)
 {
        int y;
 
        object_type forge;
        object_type *q_ptr;
        int         sval;
-       int         use_realm;
+       REALM_IDX   use_realm;
 
        char o_name[MAX_NLEN];
 
@@ -6673,7 +6675,7 @@ void display_koff(int k_idx)
        {
                int     spell = -1;
                int     num = 0;
-               byte    spells[64];
+               SPELL_IDX    spells[64];
 
                /* Extract spells */
                for (spell = 0; spell < 32; spell++)
@@ -6733,7 +6735,7 @@ object_type *choose_warning_item(void)
  * @param max 算出した最大ダメージを返すポインタ
  * @return なし
  */
-static void spell_damcalc(monster_type *m_ptr, int typ, int dam, int *max)
+static void spell_damcalc(monster_type *m_ptr, int typ, HIT_POINT dam, int *max)
 {
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
        int          rlev = r_ptr->level;
@@ -6978,10 +6980,10 @@ static void spell_damcalc(monster_type *m_ptr, int typ, int dam, int *max)
 * @param max 算出した最大ダメージを返すポインタ
 * @return なし
 */
-void spell_damcalc_by_spellnum(int spell_num, int typ, int m_idx, int *max)
+void spell_damcalc_by_spellnum(int spell_num, int typ, MONSTER_IDX m_idx, int *max)
 {
     monster_type *m_ptr = &m_list[m_idx];
-    int dam = monspell_damage((spell_num), m_idx, DAM_MAX);
+    HIT_POINT dam = monspell_damage((spell_num), m_idx, DAM_MAX);
     spell_damcalc(m_ptr, typ, dam, max);
 }
 
@@ -7716,15 +7718,18 @@ static void display_essence(void)
 static void drain_essence(void)
 {
        int drain_value[sizeof(p_ptr->magic_num1) / sizeof(s32b)];
-       int i, item;
+       int i;
+       OBJECT_IDX item;
        int dec = 4;
        bool observe = FALSE;
-       int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2, old_timeout;
+       int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2;
+       TIME_EFFECT old_timeout;
        u32b old_flgs[TR_FLAG_SIZE], new_flgs[TR_FLAG_SIZE];
        object_type *o_ptr;
        cptr q, s;
        POSITION iy, ix;
-       byte_hack marked, number;
+       byte_hack marked;
+       ITEM_NUMBER number;
        s16b next_o_idx, weight;
 
        for (i = 0; i < sizeof(drain_value) / sizeof(int); i++)
@@ -7825,7 +7830,7 @@ static void drain_essence(void)
        for (i = 0; essence_info[i].add_name; i++)
        {
                essence_type *es_ptr = &essence_info[i];
-               int pval = 0;
+               PARAMETER_VALUE pval = 0;
 
                if (es_ptr->add < TR_FLAG_MAX && is_pval_flag(es_ptr->add) && old_pval)
                        pval = (have_flag(new_flgs, es_ptr->add)) ? old_pval - o_ptr->pval : old_pval;
@@ -7955,9 +7960,9 @@ static void drain_essence(void)
  */
 static int choose_essence(void)
 {
-       int mode = 0;
+       COMMAND_CODE mode = 0;
        char choice;
-       int menu_line = (use_menu ? 1 : 0);
+       COMMAND_CODE menu_line = (use_menu ? 1 : 0);
 
 #ifdef JP
        cptr menu_name[] = {
@@ -8070,8 +8075,9 @@ static int choose_essence(void)
  */
 static void add_essence(int mode)
 {
-       int item, max_num = 0;
-       int i;
+       OBJECT_IDX item;
+       int max_num = 0;
+       COMMAND_CODE i;
        bool flag,redraw;
        char choice;
        cptr            q, s;
@@ -8419,14 +8425,14 @@ static void add_essence(int mode)
                        {
                                char tmp[80];
                                char tmp_val[160];
-                               int pval;
-                               int limit = MIN(5, p_ptr->magic_num1[es_ptr->essence]/es_ptr->value);
+                               PARAMETER_VALUE pval;
+                               PARAMETER_VALUE limit = MIN(5, p_ptr->magic_num1[es_ptr->essence]/es_ptr->value);
 
                                sprintf(tmp, _("いくつ付加しますか? (1-%d): ", "Enchant how many? (1-%d): "), limit);
                                strcpy(tmp_val, "1");
 
                                if (!get_string(tmp, tmp_val, 1)) return;
-                               pval = atoi(tmp_val);
+                               pval = (PARAMETER_VALUE)atoi(tmp_val);
                                if (pval > limit) pval = limit;
                                else if (pval < 1) pval = 1;
                                o_ptr->pval += pval;
@@ -8444,7 +8450,8 @@ static void add_essence(int mode)
                {
                        char tmp_val[160];
                        int val;
-                       int get_to_h, get_to_d;
+                       HIT_PROB get_to_h;
+                       HIT_POINT get_to_d;
 
                        strcpy(tmp_val, "1");
                        if (!get_string(format(_("いくつ付加しますか? (1-%d):", "Enchant how many? (1-%d):"), p_ptr->lev/7+3), tmp_val, 2)) return;
@@ -8582,11 +8589,11 @@ static void add_essence(int mode)
  */
 static void erase_essence(void)
 {
-       int item;
+       OBJECT_IDX item;
        cptr q, s;
        object_type *o_ptr;
        char o_name[MAX_NLEN];
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        item_tester_hook = object_is_smith;
 
@@ -8640,7 +8647,7 @@ static void erase_essence(void)
  */
 void do_cmd_kaji(bool only_browse)
 {
-       int mode = 0;
+       IDX mode = 0;
        char choice;
 
        int menu_line = (use_menu ? 1 : 0);