OSDN Git Service

[Refactor] #37353 spells2.c から spells-status.c に分離。 / Separate spells-status.c from...
[hengband/hengband.git] / src / cmd4.c
index ba00b86..e0f5397 100644 (file)
 #include "world.h"
 #include "player-status.h"
 #include "sort.h"
+#include "mutation.h"
+#include "quest.h"
+#include "store.h"
+#include "artifact.h"
+#include "avatar.h"
 
 
 /*
@@ -386,7 +391,7 @@ errr do_cmd_write_nikki(int type, int num, concptr note)
            type == NIKKI_RAND_QUEST_F ||
            type == NIKKI_TO_QUEST)
        {
-               IDX old_quest;
+               QUEST_IDX old_quest;
 
                old_quest = p_ptr->inside_quest;
                p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
@@ -3218,7 +3223,7 @@ void do_cmd_visuals(void)
                case '4':
                {
                        static concptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
-                       static IDX r = 0;
+                       static MONRACE_IDX r = 0;
 
                        prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
 
@@ -4372,10 +4377,10 @@ static byte object_group_tval[] =
  * mode & 0x01 : check for non-empty group
  * mode & 0x02 : visual operation only
  */
-static int collect_objects(int grp_cur, IDX object_idx[], BIT_FLAGS8 mode)
+static KIND_OBJECT_IDX collect_objects(int grp_cur, KIND_OBJECT_IDX object_idx[], BIT_FLAGS8 mode)
 {
-       IDX i;
-       int j, k, object_cnt = 0;
+       KIND_OBJECT_IDX i, object_cnt = 0;
+       int j, k;
 
        /* Get a list of x_char in this group */
        byte group_tval = object_group_tval[grp_cur];
@@ -4455,10 +4460,10 @@ static concptr feature_group_text[] =
  *
  * mode & 0x01 : check for non-empty group
  */
-static int collect_features(int grp_cur, IDX *feat_idx, BIT_FLAGS8 mode)
+static FEAT_IDX collect_features(int grp_cur, FEAT_IDX *feat_idx, BIT_FLAGS8 mode)
 {
-       IDX i;
-       int feat_cnt = 0;
+       FEAT_IDX i;
+       FEAT_IDX feat_cnt = 0;
 
        /* Unused;  There is a single group. */
        (void)grp_cur;
@@ -4542,18 +4547,14 @@ static char hack[17] = "dwsorgbuDWvyRGBU";
  */
 void do_cmd_load_screen(void)
 {
-       int i, y, x;
-
+       int i;
+       TERM_LEN y, x;
        TERM_COLOR a = 0;
-       char c = ' ';
-
+       SYMBOL_CODE c = ' ';
        bool okay = TRUE;
-
        FILE *fff;
-
        char buf[1024];
-
-       int wid, hgt;
+       TERM_LEN wid, hgt;
 
        Term_get_size(&wid, &hgt);
 
@@ -4628,11 +4629,9 @@ void do_cmd_load_screen(void)
                }
        }
 
-
        /* Close it */
        my_fclose(fff);
 
-
        prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
 
        flush();
@@ -4764,16 +4763,13 @@ static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OB
 static void do_cmd_knowledge_inven(void)
 {
        FILE *fff;
-
        GAME_TEXT file_name[1024];
-
        store_type  *st_ptr;
-
        OBJECT_TYPE_VALUE tval;
        int i = 0;
        int j = 0;
 
-       char  where[32];
+       char where[32];
 
        /* Open a new file */
        fff = my_fopen_temp(file_name, 1024);
@@ -4823,7 +4819,8 @@ static void do_cmd_knowledge_inven(void)
 
 void do_cmd_save_screen_html_aux(char *filename, int message)
 {
-       int y, x, i;
+       TERM_LEN y, x;
+       int i;
 
        TERM_COLOR a = 0, old_a = 0;
        char c = ' ';
@@ -4850,7 +4847,7 @@ void do_cmd_save_screen_html_aux(char *filename, int message)
                0,
        };
 
-       int wid, hgt;
+       TERM_LEN wid, hgt;
 
        Term_get_size(&wid, &hgt);
 
@@ -5047,13 +5044,10 @@ void do_cmd_save_screen(void)
        }
        else /* Dump the screen as text */
        {
-               int y, x;
-
+               TERM_LEN y, x;
                TERM_COLOR a = 0;
-               char c = ' ';
-
+               SYMBOL_CODE c = ' ';
                FILE *fff;
-
                char buf[1024];
 
                /* Build the filename */
@@ -5418,7 +5412,7 @@ static void do_cmd_knowledge_uniques(void)
        }
 
        /* Allocate the "who" array */
-       C_MAKE(who, max_r_idx, s16b);
+       C_MAKE(who, max_r_idx, MONRACE_IDX);
 
        /* Scan the monsters */
        for (i = 1; i < max_r_idx; i++)
@@ -5514,7 +5508,8 @@ static void do_cmd_knowledge_uniques(void)
  */
 static void do_cmd_knowledge_weapon_exp(void)
 {
-       int i, num, weapon_exp;
+       int i, num;
+       SUB_EXP weapon_exp;
        KIND_OBJECT_IDX j;
 
        FILE *fff;
@@ -5573,7 +5568,8 @@ static void do_cmd_knowledge_weapon_exp(void)
 static void do_cmd_knowledge_spell_exp(void)
 {
        SPELL_IDX i = 0;
-       int spell_exp, exp_level;
+       SUB_EXP spell_exp;
+       int exp_level;
 
        FILE *fff;
        const magic_type *s_ptr;
@@ -5664,10 +5660,14 @@ static void do_cmd_knowledge_skill_exp(void)
 
        FILE *fff;
 
-       GAME_TEXT file_name[1024];
-       GAME_TEXT skill_name[3][20]={_("マーシャルアーツ", "Martial Arts    "),
-                                                       _("二刀流          ", "Dual Wielding   "), 
-                                                       _("乗馬            ", "Riding          ")};
+       char file_name[1024];
+       char skill_name[GINOU_TEMPMAX][20] =
+       {
+               _("マーシャルアーツ", "Martial Arts    "),
+               _("二刀流          ", "Dual Wielding   "), 
+               _("乗馬            ", "Riding          "),
+               _("盾              ", "Shield          ")
+       };
 
        /* Open a new file */
        fff = my_fopen_temp(file_name, 1024);
@@ -5677,7 +5677,7 @@ static void do_cmd_knowledge_skill_exp(void)
            return;
        }
 
-       for (i = 0; i < 3; i++)
+       for (i = 0; i < GINOU_TEMPMAX; i++)
        {
                skill_exp = p_ptr->skill_exp[i];
                fprintf(fff, "%-20s ", skill_name[i]);
@@ -6266,11 +6266,11 @@ static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, b
  *  Clipboard variables for copy&paste in visual mode
  */
 static TERM_COLOR attr_idx = 0;
-static byte char_idx = 0;
+static SYMBOL_CODE char_idx = 0;
 
 /* Hack -- for feature lighting */
 static TERM_COLOR attr_idx_feat[F_LIT_MAX];
-static byte char_idx_feat[F_LIT_MAX];
+static SYMBOL_CODE char_idx_feat[F_LIT_MAX];
 
 /*
  *  Do visual mode command -- Change symbols
@@ -6368,8 +6368,8 @@ static bool visual_mode_command(char ch, bool *visual_list_ptr,
                {
                        int eff_width;
                        int d = get_keymap_dir(ch);
-                       byte a = (*cur_attr_ptr & 0x7f);
-                       byte c = *cur_char_ptr;
+                       TERM_COLOR a = (*cur_attr_ptr & 0x7f);
+                       SYMBOL_CODE c = *cur_char_ptr;
 
                        if (use_bigtile) eff_width = width / 2;
                        else eff_width = width;
@@ -6497,7 +6497,7 @@ static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX d
        browser_rows = hgt - 8;
 
        /* Allocate the "mon_idx" array */
-       C_MAKE(mon_idx, max_r_idx, s16b);
+       C_MAKE(mon_idx, max_r_idx, MONRACE_IDX);
 
        max = 0;
        grp_cnt = 0;
@@ -6703,7 +6703,7 @@ static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX d
        }
 
        /* Free the "mon_idx" array */
-       C_KILL(mon_idx, max_r_idx, s16b);
+       C_KILL(mon_idx, max_r_idx, MONRACE_IDX);
 }
 
 
@@ -6720,7 +6720,7 @@ static void display_object_list(int col, int row, int per_page, IDX object_idx[]
        {
                GAME_TEXT o_name[MAX_NLEN];
                TERM_COLOR a;
-               byte c;
+               SYMBOL_CODE c;
                object_kind *flavor_k_ptr;
 
                /* Get the object index */
@@ -6831,7 +6831,7 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
        int grp_cnt;
        IDX grp_idx[100];
        int object_cnt;
-       IDX *object_idx;
+       OBJECT_IDX *object_idx;
 
        int column = 0;
        bool flag;
@@ -6842,7 +6842,7 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
        byte char_left = 0;
 
        int browser_rows;
-       int wid, hgt;
+       TERM_LEN wid, hgt;
 
        byte mode;
 
@@ -6851,7 +6851,7 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
        browser_rows = hgt - 8;
 
        /* Allocate the "object_idx" array */
-       C_MAKE(object_idx, max_k_idx, IDX);
+       C_MAKE(object_idx, max_k_idx, KIND_OBJECT_IDX);
 
        max = 0;
        grp_cnt = 0;
@@ -7104,7 +7104,7 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
        }
 
        /* Free the "object_idx" array */
-       C_KILL(object_idx, max_k_idx, IDX);
+       C_KILL(object_idx, max_k_idx, KIND_OBJECT_IDX);
 }
 
 
@@ -7209,8 +7209,8 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX d
        TERM_COLOR *cur_attr_ptr;
        SYMBOL_CODE *cur_char_ptr;
 
-       (void)C_WIPE(attr_old, F_LIT_MAX, byte);
-       (void)C_WIPE(char_old, F_LIT_MAX, byte);
+       (void)C_WIPE(attr_old, F_LIT_MAX, TERM_COLOR);
+       (void)C_WIPE(char_old, F_LIT_MAX, SYMBOL_CODE);
 
        Term_get_size(&wid, &hgt);
 
@@ -7527,15 +7527,10 @@ static void do_cmd_knowledge_kubi(void)
        {
                bool listed = FALSE;
 
-#ifdef JP
-               fprintf(fff, "今日のターゲット : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "不明"));
+               fprintf(fff, _("今日のターゲット : %s\n", "Today target : %s\n"),
+                       (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : _("不明", "unknown")));
                fprintf(fff, "\n");
-               fprintf(fff, "賞金首リスト\n");
-#else
-               fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
-               fprintf(fff, "\n");
-               fprintf(fff, "List of wanted monsters\n");
-#endif
+               fprintf(fff, _("賞金首リスト\n", "List of wanted monsters\n"));
                fprintf(fff, "----------------------------------------------\n");
 
                for (i = 0; i < MAX_KUBI; i++)
@@ -7593,9 +7588,8 @@ static void do_cmd_knowledge_virtues(void)
 }
 
 /*
-* Dungeon
-*
-*/
+ * Dungeon
+ */
 static void do_cmd_knowledge_dungeon(void)
 {
        FILE *fff;
@@ -7662,15 +7656,11 @@ static void do_cmd_knowledge_stat(void)
                        (2 * p_ptr->hitdie +
                        ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
 
-#ifdef JP
-               if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "現在の体力ランク : %d/100\n\n", percent);
-               else fprintf(fff, "現在の体力ランク : ???\n\n");
-               fprintf(fff, "能力の最大値\n\n");
-#else
-               if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
-               else fprintf(fff, "Your current Life Rating is ???.\n\n");
-               fprintf(fff, "Limits of maximum stats\n\n");
-#endif
+               if (p_ptr->knowledge & KNOW_HPRATE)
+                       fprintf(fff, _("現在の体力ランク : %d/100\n\n", "Your current Life Rating is %d/100.\n\n"), percent);
+               else fprintf(fff, _("現在の体力ランク : ???\n\n", "Your current Life Rating is ???.\n\n"));
+
+               fprintf(fff, _("能力の最大値\n\n", "Limits of maximum stats\n\n"));
                for (v_nr = 0; v_nr < A_MAX; v_nr++)
                {
                        if ((p_ptr->knowledge & KNOW_STAT) || p_ptr->stat_max[v_nr] == p_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], p_ptr->stat_max_max[v_nr]-18);
@@ -7698,7 +7688,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
        char rand_tmp_str[120] = "\0";
        GAME_TEXT name[MAX_NLEN];
        monster_race *r_ptr;
-       IDX i;
+       QUEST_IDX i;
        int rand_level = 100;
        int total = 0;
 
@@ -7711,7 +7701,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                        (quest[i].status == QUEST_STATUS_COMPLETED))
                {
                        /* Set the quest number temporary */
-                       IDX old_quest = p_ptr->inside_quest;
+                       QUEST_IDX old_quest = p_ptr->inside_quest;
                        int j;
 
                        /* Clear the text */
@@ -7926,21 +7916,20 @@ static bool do_cmd_knowledge_quests_aux(FILE *fff, IDX q_idx)
 /*
  * Print all finished quests
  */
-void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[])
+void do_cmd_knowledge_quests_completed(FILE *fff, QUEST_IDX quest_num[])
 {
-       int i;
-       int total = 0;
+       QUEST_IDX i;
+       QUEST_IDX total = 0;
 
        fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
        for (i = 1; i < max_q_idx; i++)
        {
-               IDX q_idx = quest_num[i];
+               QUEST_IDX q_idx = quest_num[i];
                quest_type* const q_ptr = &quest[q_idx];
 
-               if (q_ptr->status == QUEST_STATUS_FINISHED &&
-                   do_cmd_knowledge_quests_aux(fff, q_idx))
+               if (q_ptr->status == QUEST_STATUS_FINISHED && do_cmd_knowledge_quests_aux(fff, q_idx))
                {
-                       ++ total;
+                       ++total;
                }
        }
        if (!total) fprintf(fff, _("  なし\n", "  Nothing.\n"));
@@ -7950,21 +7939,21 @@ void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[])
 /*
  * Print all failed quests
  */
-void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[])
+void do_cmd_knowledge_quests_failed(FILE *fff, QUEST_IDX quest_num[])
 {
-       IDX i;
-       int total = 0;
+       QUEST_IDX i;
+       QUEST_IDX total = 0;
 
        fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
        for (i = 1; i < max_q_idx; i++)
        {
-               IDX q_idx = quest_num[i];
+               QUEST_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)) &&
                    do_cmd_knowledge_quests_aux(fff, q_idx))
                {
-                       ++ total;
+                       ++total;
                }
        }
        if (!total) fprintf(fff, _("  なし\n", "  Nothing.\n"));
@@ -7976,9 +7965,9 @@ void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[])
  */
 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
 {
-       char tmp_str[120];
-       int i;
-       int total = 0;
+       GAME_TEXT tmp_str[120];
+       QUEST_IDX i;
+       QUEST_IDX total = 0;
 
        fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
        for (i = 1; i < max_q_idx; i++)
@@ -8049,7 +8038,7 @@ static void do_cmd_knowledge_quests(void)
        }
 
        /* Allocate Memory */
-       C_MAKE(quest_num, max_q_idx, IDX);
+       C_MAKE(quest_num, max_q_idx, QUEST_IDX);
 
        /* Sort by compete level */
        for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
@@ -8077,7 +8066,7 @@ static void do_cmd_knowledge_quests(void)
        fd_kill(file_name);
 
        /* Free Memory */
-       C_KILL(quest_num, max_q_idx, IDX);
+       C_KILL(quest_num, max_q_idx, QUEST_IDX);
 }
 
 
@@ -8434,16 +8423,8 @@ void do_cmd_time(void)
        if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
        else strcpy(day_buf, "*****");
 
-#ifdef JP
-       msg_format("%s日目, 時刻は%d:%02d %sです。",
-                  day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
-                  min, (hour < 12) ? "AM" : "PM");
-#else
-       msg_format("This is day %s. The time is %d:%02d %s.",
-                  day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
-                  min, (hour < 12) ? "AM" : "PM");
-#endif
-
+       msg_format(_("%s日目, 時刻は%d:%02d %sです。", "This is day %s. The time is %d:%02d %s."),
+                  day_buf, (hour % 12 == 0) ? 12 : (hour % 12), min, (hour < 12) ? "AM" : "PM");
 
        /* Find the path */
        if (!randint0(10) || p_ptr->image)