OSDN Git Service

#37287 #37353 (2.2.0.89) ACTION_IDX 型を定義し、型の置換を継続中。 / Define ACTION_IDX, ongoing...
[hengband/hengband.git] / src / cmd4.c
index c2ae792..1ba5d6d 100644 (file)
@@ -2593,7 +2593,7 @@ static errr keymap_dump(cptr fname)
        char key[1024];
        char buf[1024];
 
-       int mode;
+       BIT_FLAGS mode;
 
        /* Roguelike */
        if (rogue_like_commands)
@@ -2632,7 +2632,7 @@ static errr keymap_dump(cptr fname)
                if (!act) continue;
 
                /* Encode the key */
-               buf[0] = i;
+               buf[0] = (char)i;
                buf[1] = '\0';
                ascii_to_text(key, buf);
 
@@ -2671,7 +2671,7 @@ void do_cmd_macros(void)
 
        char buf[1024];
 
-       int mode;
+       BIT_FLAGS mode;
 
 
        /* Roguelike */
@@ -3088,19 +3088,19 @@ static cptr lighting_level_str[F_LIT_MAX] =
  * @param max ビジュアルIDの最大数
  * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
  */
-static bool cmd_visuals_aux(int i, int *num, int max)
+static bool cmd_visuals_aux(int i, IDX *num, IDX max)
 {
        if (iscntrl(i))
        {
                char str[10] = "";
-               int tmp;
+               IDX tmp;
 
                sprintf(str, "%d", *num);
 
                if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
                        return FALSE;
 
-               tmp = strtol(str, NULL, 0);
+               tmp = (IDX)strtol(str, NULL, 0);
                if (tmp >= 0 && tmp < max)
                        *num = tmp;
        }
@@ -3144,14 +3144,14 @@ static void print_visuals_menu(cptr choice_msg)
 
 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx);
 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx);
-static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, int *lighting_level);
+static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level);
 
 /*
  * Interact with "visuals"
  */
 void do_cmd_visuals(void)
 {
-       int i;
+       char i;
        char tmp[160];
        char buf[1024];
        bool need_redraw = FALSE;
@@ -3393,7 +3393,7 @@ void do_cmd_visuals(void)
                        {
                                monster_race *r_ptr = &r_info[r];
                                char c;
-                               int t;
+                               IDX t;
 
                                byte da = r_ptr->d_attr;
                                byte dc = r_ptr->d_char;
@@ -3436,7 +3436,7 @@ void do_cmd_visuals(void)
                                {
                                case 'n':
                                        {
-                                               int prev_r = r;
+                                               IDX prev_r = r;
                                                do
                                                {
                                                        if (!cmd_visuals_aux(i, &r, max_r_idx))
@@ -3485,12 +3485,12 @@ void do_cmd_visuals(void)
                        {
                                object_kind *k_ptr = &k_info[k];
                                char c;
-                               int t;
+                               IDX t;
 
-                               byte da = k_ptr->d_attr;
-                               byte dc = k_ptr->d_char;
-                               byte ca = k_ptr->x_attr;
-                               byte cc = k_ptr->x_char;
+                               SYMBOL_COLOR da = k_ptr->d_attr;
+                               SYMBOL_CODE dc = k_ptr->d_char;
+                               SYMBOL_COLOR ca = k_ptr->x_attr;
+                               SYMBOL_CODE cc = k_ptr->x_char;
 
                                /* Label the object */
                                Term_putstr(5, 17, -1, TERM_WHITE,
@@ -3529,7 +3529,7 @@ void do_cmd_visuals(void)
                                {
                                case 'n':
                                        {
-                                               int prev_k = k;
+                                               IDX prev_k = k;
                                                do
                                                {
                                                        if (!cmd_visuals_aux(i, &k, max_k_idx))
@@ -3570,8 +3570,8 @@ void do_cmd_visuals(void)
                case '6':
                {
                        static cptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
-                       static int f = 0;
-                       static int lighting_level = F_LIT_STANDARD;
+                       static IDX f = 0;
+                       static IDX lighting_level = F_LIT_STANDARD;
                        prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
 
                        /* Hack -- query until done */
@@ -3579,7 +3579,7 @@ void do_cmd_visuals(void)
                        {
                                feature_type *f_ptr = &f_info[f];
                                char c;
-                               int t;
+                               IDX t;
 
                                byte da = f_ptr->d_attr[lighting_level];
                                byte dc = f_ptr->d_char[lighting_level];
@@ -3634,7 +3634,7 @@ void do_cmd_visuals(void)
                                {
                                case 'n':
                                        {
-                                               int prev_f = f;
+                                               IDX prev_f = f;
                                                do
                                                {
                                                        if (!cmd_visuals_aux(i, &f, max_f_idx))
@@ -3691,7 +3691,7 @@ void do_cmd_visuals(void)
                /* Modify feature attr/chars (visual mode) */
                case '9':
                {
-                       int lighting_level = F_LIT_STANDARD;
+                       IDX lighting_level = F_LIT_STANDARD;
                        do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
                        break;
                }
@@ -4314,9 +4314,10 @@ static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
  * mode & 0x01 : check for non-empty group
  * mode & 0x02 : visual operation only
  */
-static int collect_monsters(int grp_cur, s16b mon_idx[], BIT_FLAGS8 mode)
+static IDX collect_monsters(IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode)
 {
-       int i, mon_cnt = 0;
+       IDX i;
+       IDX mon_cnt = 0;
        int dummy_why;
 
        /* Get a list of x_char in this group */
@@ -4814,7 +4815,7 @@ void do_cmd_load_screen(void)
                        for (i = 0; i < 16; i++)
                        {
                                /* Use attr matches */
-                               if (hack[i] == buf[x]) a = i;
+                               if (hack[i] == buf[x]) a = (byte_hack)i;
                        }
 
                        /* Put the attr/char */
@@ -5449,10 +5450,12 @@ static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
  */
 static void do_cmd_knowledge_artifacts(void)
 {
-       int i, k, x, y, n = 0;
+       IDX i;
+       IDX k;
+       int x, y, n = 0;
        IDX z;
        u16b why = 3;
-       s16b *who;
+       IDX *who;
 
        FILE *fff;
 
@@ -5617,7 +5620,8 @@ static void do_cmd_knowledge_artifacts(void)
  */
 static void do_cmd_knowledge_uniques(void)
 {
-       int i, k, n = 0;
+       IDX i;
+       int k, n = 0;
        u16b why = 2;
        IDX *who;
 
@@ -5743,7 +5747,8 @@ static void do_cmd_knowledge_uniques(void)
  */
 static void do_cmd_knowledge_weapon_exp(void)
 {
-       int i, j, num, weapon_exp;
+       int i, num, weapon_exp;
+       KIND_OBJECT_IDX j;
 
        FILE *fff;
 
@@ -5802,7 +5807,8 @@ static void do_cmd_knowledge_weapon_exp(void)
  */
 static void do_cmd_knowledge_spell_exp(void)
 {
-       int i = 0, spell_exp, exp_level;
+       SPELL_IDX i = 0;
+       int spell_exp, exp_level;
 
        FILE *fff;
        const magic_type *s_ptr;
@@ -6130,9 +6136,10 @@ static void do_cmd_knowledge_pets(void)
  */
 static void do_cmd_knowledge_kill_count(void)
 {
-       int i, k, n = 0;
+       IDX i;
+       int k, n = 0;
        u16b why = 2;
-       s16b *who;
+       IDX *who;
 
        FILE *fff;
 
@@ -6172,7 +6179,7 @@ static void do_cmd_knowledge_kill_count(void)
                        }
                        else
                        {
-                               s16b This = r_ptr->r_pkills;
+                               MONSTER_NUMBER This = r_ptr->r_pkills;
 
                                if (This > 0)
                                {
@@ -6228,16 +6235,16 @@ static void do_cmd_knowledge_kill_count(void)
                }
                else
                {
-                       s16b This = r_ptr->r_pkills;
+                       MONSTER_NUMBER This = r_ptr->r_pkills;
 
                        if (This > 0)
                        {
 #ifdef JP
                                /* p,tは人と数える by ita */
                                if (my_strchr("pt", r_ptr->d_char))
-                                       fprintf(fff, "     %3d 人の %s\n", This, r_name + r_ptr->name);
+                                       fprintf(fff, "     %3d 人の %s\n", (int)This, r_name + r_ptr->name);
                                else
-                                       fprintf(fff, "     %3d 体の %s\n", This, r_name + r_ptr->name);
+                                       fprintf(fff, "     %3d 体の %s\n", (int)This, r_name + r_ptr->name);
 #else
                                if (This < 2)
                                {
@@ -6664,7 +6671,7 @@ static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
                byte attr;
 
                /* Get the race index */
-               int r_idx = mon_idx[mon_top + i] ;
+               MONRACE_IDX r_idx = mon_idx[mon_top + i] ;
 
                /* Access the race */
                monster_race *r_ptr = &r_info[r_idx];
@@ -6731,7 +6738,7 @@ static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX d
        byte attr_top = 0, char_left = 0;
 
        int browser_rows;
-       POSITION wid, hgt;
+       TERM_POSITION wid, hgt;
 
        BIT_FLAGS8 mode;
 
@@ -6987,7 +6994,7 @@ static void display_object_list(int col, int row, int per_page, IDX object_idx[]
                object_kind *flavor_k_ptr;
 
                /* Get the object index */
-               int k_idx = object_idx[object_top + i];
+               KIND_OBJECT_IDX k_idx = object_idx[object_top + i];
 
                /* Access the object */
                object_kind *k_ptr = &k_info[k_idx];
@@ -7381,8 +7388,8 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
 /*
  * Display the features in a group.
  */
-static void display_feature_list(int col, int row, int per_page, int *feat_idx,
-       int feat_cur, int feat_top, bool visual_only, int lighting_level)
+static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx,
+       FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level)
 {
        int lit_col[F_LIT_MAX], i, j;
        int f_idx_col = use_bigtile ? 62 : 64;
@@ -7398,7 +7405,7 @@ static void display_feature_list(int col, int row, int per_page, int *feat_idx,
                byte attr;
 
                /* Get the index */
-               int f_idx = feat_idx[feat_top + i];
+               FEAT_IDX f_idx = feat_idx[feat_top + i];
 
                /* Access the index */
                feature_type *f_ptr = &f_info[f_idx];
@@ -7452,7 +7459,7 @@ static void display_feature_list(int col, int row, int per_page, int *feat_idx,
 /*
  * Interact with feature visuals.
  */
-static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, int *lighting_level)
+static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level)
 {
        IDX i;
        int len, max;
@@ -8052,11 +8059,11 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                                                {
 #ifdef JP
                                                        sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
-                                                               quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
+                                                               (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
 #else
                                                        plural_aux(name);
                                                        sprintf(note," - kill %d %s, have killed %d.",
-                                                               quest[i].max_num, name, quest[i].cur_num);
+                                                               (int)quest[i].max_num, name, (int)quest[i].cur_num);
 #endif
                                                }
                                                else
@@ -8084,10 +8091,10 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                                        case QUEST_TYPE_KILL_NUMBER:
 #ifdef JP
                                                sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
-                                                       quest[i].max_num, quest[i].max_num - quest[i].cur_num);
+                                                       (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num));
 #else
                                                sprintf(note," - Kill %d monsters, have killed %d.",
-                                                       quest[i].max_num, quest[i].cur_num);
+                                                       (int)quest[i].max_num, (int)quest[i].cur_num);
 #endif
                                                break;
 
@@ -8136,24 +8143,19 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
 #ifdef JP
                                                sprintf(rand_tmp_str,"  %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
                                                        quest[i].name, (int)quest[i].level,
-                                                       quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
+                                                       (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
 #else
                                                plural_aux(name);
 
                                                sprintf(rand_tmp_str,"  %s (Dungeon level: %d)\n  Kill %d %s, have killed %d.\n",
-                                                       quest[i].name, (idx)quest[i].level,
-                                                       quest[i].max_num, name, quest[i].cur_num);
+                                                       quest[i].name, (int)quest[i].level,
+                                                       (int)quest[i].max_num, name, (int)quest[i].cur_num);
 #endif
                                        }
                                        else
                                        {
-#ifdef JP
-                                               sprintf(rand_tmp_str,"  %s (%d 階) - %sを倒す。\n",
-                                                       quest[i].name, quest[i].level, name);
-#else
-                                               sprintf(rand_tmp_str,"  %s (Dungeon level: %d)\n  Kill %s.\n",
-                                                       quest[i].name, quest[i].level, name);
-#endif
+                                               sprintf(rand_tmp_str,_("  %s (%d 階) - %sを倒す。\n", "  %s (Dungeon level: %d)\n  Kill %s.\n"),
+                                                       quest[i].name, (int)quest[i].level, name);
                                        }
                                }
                        }
@@ -8260,13 +8262,13 @@ void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[])
  */
 void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[])
 {
-       int i;
+       IDX i;
        int total = 0;
 
        fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
        for (i = 1; i < max_quests; i++)
        {
-               int q_idx = quest_num[i];
+               IDX q_idx = quest_num[i];
                quest_type* const q_ptr = &quest[q_idx];
 
                if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
@@ -8310,7 +8312,7 @@ static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
 
 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
 {
-       int *q_num = (int *)u;
+       QUEST_IDX *q_num = (QUEST_IDX *)u;
        quest_type *qa = &quest[q_num[a]];
        quest_type *qb = &quest[q_num[b]];
 
@@ -8322,8 +8324,8 @@ bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
 
 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
 {
-       int *q_num = (int *)u;
-       int tmp;
+       QUEST_IDX *q_num = (QUEST_IDX *)u;
+       QUEST_IDX tmp;
 
        /* Unused */
        (void)v;
@@ -8678,7 +8680,7 @@ void do_cmd_knowledge(void)
                        break;
                case '0': /* Feature list */
                        {
-                               int lighting_level = F_LIT_STANDARD;
+                               IDX lighting_level = F_LIT_STANDARD;
                                do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
                        }
                        break;