OSDN Git Service

[Refactor] #37353 プレイヤーのダメージ処理を spells3.c から player-damage.c/h へ分離。
[hengband/hengband.git] / src / cmd4.c
index 37e9e31..d7e068b 100644 (file)
@@ -369,7 +369,7 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
        cptr note_level = "";
        bool do_level = TRUE;
        char note_level_buf[40];
-       int q_idx;
+       QUEST_IDX q_idx;
 
        static bool disable_nikki = FALSE;
 
@@ -426,7 +426,7 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
                else if (!dun_level)
                        note_level = _("地上:", "Surface:");
                else if (q_idx && (is_fixed_quest_idx(q_idx)
-                        && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
+                       && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
                        note_level = _("クエスト:", "Quest:");
                else
                {
@@ -798,7 +798,7 @@ static void do_cmd_disp_nikki(void)
 
        if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
                strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
-       else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
+       else if (IS_WIZARD_CLASS())
                strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
        else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
 
@@ -918,7 +918,6 @@ void do_cmd_nikki(void)
                /* Prompt */
                i = inkey();
 
-               /* Done */
                if (i == ESCAPE) break;
 
                switch (i)
@@ -984,7 +983,6 @@ void do_cmd_redraw(void)
        /* Update torch */
        p_ptr->update |= (PU_TORCH);
 
-       /* Update stuff */
        p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
 
        /* Forget lite/view */
@@ -999,10 +997,8 @@ void do_cmd_redraw(void)
        /* Redraw everything */
        p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
 
-       /* Window stuff */
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
 
-       /* Window stuff */
        p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
 
        update_playtime();
@@ -1109,7 +1105,6 @@ void do_cmd_change_name(void)
                        mode++;
                }
 
-               /* Oops */
                else
                {
                        bell();
@@ -1136,7 +1131,7 @@ void do_cmd_change_name(void)
  */
 void do_cmd_message_one(void)
 {
-       /* Recall one message XXX XXX XXX */
+       /* Recall one message */
        prt(format("> %s", message_str(0)), 0, 0);
 }
 
@@ -1236,7 +1231,7 @@ void do_cmd_messages(int num_now)
                        Term_erase(0, num_lines + 1 - j, 255);
                }
 
-               /* Display header XXX XXX XXX */
+               /* Display header */
                /* translation */
                prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
                           i, i + j - 1, n), 0, 0);
@@ -1270,7 +1265,6 @@ void do_cmd_messages(int num_now)
                        }
                        else strcpy(shower_str, back_str);
 
-                       /* Okay */
                        continue;
 
                /* Hack -- handle find */
@@ -1309,7 +1303,6 @@ void do_cmd_messages(int num_now)
                                                /* New location */
                                                i = z;
 
-                                               /* Done */
                                                break;
                                        }
                                }
@@ -1401,9 +1394,9 @@ static void do_cmd_options_cheat(cptr info)
        /* Interact with the player */
        while (TRUE)
        {
-               int dir;
+               DIRECTION dir;
 
-               /* Prompt XXX XXX XXX */
+               /* Prompt */
                sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
 
                prt(buf, 0, 0);
@@ -1512,18 +1505,6 @@ static void do_cmd_options_cheat(cptr info)
 
 
 /*!
- * 自動セーブオプションテーブル
- */
-static option_type autosave_info[2] =
-{
-       { &autosave_l,      FALSE, 255, 0x01, 0x00,
-           "autosave_l",    _("新しい階に入る度に自動セーブする", "Autosave when entering new levels") },
-
-       { &autosave_t,      FALSE, 255, 0x02, 0x00,
-           "autosave_t",   _("一定ターン毎に自動セーブする", "Timed autosave") },
-};
-
-/*!
  * @brief セーブ頻度ターンの次の値を返す
  * @param current 現在のセーブ頻度ターン値
  * @return 次のセーブ頻度ターン値
@@ -1566,7 +1547,7 @@ static void do_cmd_options_autosave(cptr info)
        /* Interact with the player */
        while (TRUE)
        {
-               /* Prompt XXX XXX XXX */
+               /* Prompt */
                sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ", 
                                           "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
 
@@ -1697,9 +1678,9 @@ void do_cmd_options_aux(int page, cptr info)
        /* Interact with the player */
        while (TRUE)
        {
-               int dir;
+               DIRECTION dir;
 
-               /* Prompt XXX XXX XXX */
+               /* Prompt */
                sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "),
                                        info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
                prt(buf, 0, 0);
@@ -1822,8 +1803,8 @@ void do_cmd_options_aux(int page, cptr info)
 static void do_cmd_options_win(void)
 {
        int i, j, d;
-       int y = 0;
-       int x = 0;
+       TERM_LEN y = 0;
+       TERM_LEN x = 0;
        char ch;
        bool go = TRUE;
        u32b old_flag[8];
@@ -1843,7 +1824,7 @@ static void do_cmd_options_win(void)
        /* Interact */
        while (go)
        {
-               /* Prompt XXX XXX XXX */
+               /* Prompt */
                prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
 
                /* Display the windows */
@@ -2055,8 +2036,8 @@ option_fields[OPT_NUM] =
 void do_cmd_options(void)
 {
        char k;
-       int i, d, skey;
-       int y = 0;
+       int d, skey;
+       TERM_LEN i, y = 0;
 
        /* Save the screen */
        screen_save();
@@ -2323,7 +2304,6 @@ void do_cmd_options(void)
                        /* Unknown option */
                        default:
                        {
-                               /* Oops */
                                bell();
                                break;
                        }
@@ -2348,7 +2328,7 @@ void do_cmd_options(void)
  * Ask for a "user pref line" and process it
  * @return なし
  * @details
- * XXX XXX XXX Allow absolute file names?
+ * Allow absolute file names?
  */
 void do_cmd_pref(void)
 {
@@ -2496,7 +2476,7 @@ static void do_cmd_macro_aux(char *buf)
  * @details
  * <pre>
  * Note that both "flush()" calls are extremely important.  This may
- * no longer be true, since "util.c" is much simpler now.  XXX XXX XXX
+ * no longer be true, since "util.c" is much simpler now.  
  * </pre>
  */
 static void do_cmd_macro_aux_keymap(char *buf)
@@ -2607,7 +2587,7 @@ static errr keymap_dump(cptr fname)
  * <pre>
  * Note that the macro "action" must be defined before the trigger.
  *
- * Could use some helpful instructions on this page.  XXX XXX XXX
+ * Could use some helpful instructions on this page.  
  * </pre>
  */
 void do_cmd_macros(void)
@@ -2996,10 +2976,8 @@ void do_cmd_macros(void)
 
 #endif /* ALLOW_MACROS */
 
-               /* Oops */
                else
                {
-                       /* Oops */
                        bell();
                }
 
@@ -3124,7 +3102,6 @@ void do_cmd_visuals(void)
                /* Prompt */
                i = inkey();
 
-               /* Done */
                if (i == ESCAPE) break;
 
                switch (i)
@@ -3196,7 +3173,6 @@ void do_cmd_visuals(void)
                        /* Close */
                        close_auto_dump();
 
-                       /* Message */
                        msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
 
                        break;
@@ -3206,7 +3182,7 @@ void do_cmd_visuals(void)
                case '2':
                {
                        static cptr mark = "Object attr/chars";
-                       IDX k_idx;
+                       KIND_OBJECT_IDX k_idx;
 
                        /* Prompt */
                        prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
@@ -3265,7 +3241,6 @@ void do_cmd_visuals(void)
                        /* Close */
                        close_auto_dump();
 
-                       /* Message */
                        msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
 
                        break;
@@ -3321,7 +3296,6 @@ void do_cmd_visuals(void)
                        /* Close */
                        close_auto_dump();
 
-                       /* Message */
                        msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
 
                        break;
@@ -3342,9 +3316,9 @@ void do_cmd_visuals(void)
                                int c;
                                IDX t;
 
-                               byte da = r_ptr->d_attr;
+                               TERM_COLOR da = r_ptr->d_attr;
                                byte dc = r_ptr->d_char;
-                               byte ca = r_ptr->x_attr;
+                               TERM_COLOR ca = r_ptr->x_attr;
                                byte cc = r_ptr->x_char;
 
                                /* Label the object */
@@ -3434,9 +3408,9 @@ void do_cmd_visuals(void)
                                int c;
                                IDX t;
 
-                               SYMBOL_COLOR da = k_ptr->d_attr;
+                               TERM_COLOR da = k_ptr->d_attr;
                                SYMBOL_CODE dc = k_ptr->d_char;
-                               SYMBOL_COLOR ca = k_ptr->x_attr;
+                               TERM_COLOR ca = k_ptr->x_attr;
                                SYMBOL_CODE cc = k_ptr->x_char;
 
                                /* Label the object */
@@ -3528,9 +3502,9 @@ void do_cmd_visuals(void)
                                int c;
                                IDX t;
 
-                               byte da = f_ptr->d_attr[lighting_level];
+                               TERM_COLOR da = f_ptr->d_attr[lighting_level];
                                byte dc = f_ptr->d_char[lighting_level];
-                               byte ca = f_ptr->x_attr[lighting_level];
+                               TERM_COLOR ca = f_ptr->x_attr[lighting_level];
                                byte cc = f_ptr->x_char[lighting_level];
 
                                /* Label the object */
@@ -3651,7 +3625,6 @@ void do_cmd_visuals(void)
                        /* Reset */
                        reset_visuals();
 
-                       /* Message */
                        msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
                        need_redraw = TRUE;
                        break;
@@ -3715,7 +3688,6 @@ void do_cmd_colors(void)
                /* Prompt */
                i = inkey();
 
-               /* Done */
                if (i == ESCAPE) break;
 
                /* Load a 'pref' file */
@@ -3798,7 +3770,6 @@ void do_cmd_colors(void)
                        /* Close */
                        close_auto_dump();
 
-                       /* Message */
                        msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
                }
 
@@ -4680,7 +4651,7 @@ void do_cmd_load_screen(void)
 {
        int i, y, x;
 
-       byte a = 0;
+       TERM_COLOR a = 0;
        char c = ' ';
 
        bool okay = TRUE;
@@ -4699,7 +4670,6 @@ void do_cmd_load_screen(void)
        /* Append to the file */
        fff = my_fopen(buf, "r");
 
-       /* Oops */
        if (!fff) {
                msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
                msg_print(NULL);
@@ -4775,7 +4745,6 @@ void do_cmd_load_screen(void)
        my_fclose(fff);
 
 
-       /* Message */
        prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
 
        flush();
@@ -4810,10 +4779,10 @@ cptr inven_res_label = _("                               酸電火冷毒光闇
 
 
 /* XTRA HACK RESLIST */
-static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
+static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where)
 {
        char o_name[MAX_NLEN];
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        if (!o_ptr->k_idx) return;
        if (o_ptr->tval != tval) return;
@@ -4914,7 +4883,7 @@ static void do_cmd_knowledge_inven(void)
 
        store_type  *st_ptr;
 
-       byte tval;
+       OBJECT_TYPE_VALUE tval;
        int i = 0;
        int j = 0;
 
@@ -4972,7 +4941,7 @@ void do_cmd_save_screen_html_aux(char *filename, int message)
 {
        int y, x, i;
 
-       byte a = 0, old_a = 0;
+       TERM_COLOR a = 0, old_a = 0;
        char c = ' ';
 
        FILE *fff, *tmpfff;
@@ -5007,7 +4976,6 @@ void do_cmd_save_screen_html_aux(char *filename, int message)
        /* Append to the file */
        fff = my_fopen(filename, "w");
 
-       /* Oops */
        if (!fff) {
                if (message) {
                    msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
@@ -5113,7 +5081,6 @@ void do_cmd_save_screen_html_aux(char *filename, int message)
        /* Close it */
        my_fclose(fff);
 
-       /* Message */
        if (message) {
                msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
                msg_print(NULL);
@@ -5207,7 +5174,7 @@ void do_cmd_save_screen(void)
        {
                int y, x;
 
-               byte a = 0;
+               TERM_COLOR a = 0;
                char c = ' ';
 
                FILE *fff;
@@ -5223,7 +5190,6 @@ void do_cmd_save_screen(void)
                /* Append to the file */
                fff = my_fopen(buf, "w");
 
-               /* Oops */
                if (!fff)
                {
                        msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
@@ -5287,7 +5253,6 @@ void do_cmd_save_screen(void)
                /* Close it */
                my_fclose(fff);
 
-               /* Message */
                msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
                msg_print(NULL);
 
@@ -5399,7 +5364,8 @@ static void do_cmd_knowledge_artifacts(void)
 {
        IDX i;
        IDX k;
-       int x, y, n = 0;
+       POSITION x, y;
+       int n = 0;
        IDX z;
        u16b why = 3;
        IDX *who;
@@ -5452,7 +5418,7 @@ static void do_cmd_knowledge_artifacts(void)
                {
                        cave_type *c_ptr = &cave[y][x];
 
-                       s16b this_o_idx, next_o_idx = 0;
+                       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
                        /* Scan all objects in the grid */
                        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
@@ -6079,7 +6045,7 @@ static void do_cmd_knowledge_pets(void)
  * @brief 現在のペットを表示するコマンドのメインルーチン /
  * Total kill count
  * @return なし
- * @note the player ghosts are ignored.  XXX XXX XXX
+ * @note the player ghosts are ignored.  
  */
 static void do_cmd_knowledge_kill_count(void)
 {
@@ -6393,7 +6359,7 @@ static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt,
 /*
  * Display visuals.
  */
-static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
+static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left)
 {
        int i, j;
 
@@ -6414,8 +6380,8 @@ static void display_visual_list(int col, int row, int height, int width, byte at
                {
                        byte a;
                        char c;
-                       int x = col + j;
-                       int y = row + i;
+                       TERM_LEN x = col + j;
+                       TERM_LEN y = row + i;
                        int ia, ic;
 
                        /* Bigtile mode uses double width */
@@ -6445,13 +6411,13 @@ static void display_visual_list(int col, int row, int height, int width, byte at
 /*
  * Place the cursor at the collect position for visual mode
  */
-static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
+static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left)
 {
        int i = (a & 0x7f) - attr_top;
        int j = c - char_left;
 
-       int x = col + j;
-       int y = row + i;
+       TERM_LEN x = col + j;
+       TERM_LEN y = row + i;
 
        /* Bigtile mode uses double width */
        if (use_bigtile) x += j;
@@ -6464,11 +6430,11 @@ static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr
 /*
  *  Clipboard variables for copy&paste in visual mode
  */
-static byte attr_idx = 0;
+static TERM_COLOR attr_idx = 0;
 static byte char_idx = 0;
 
 /* Hack -- for feature lighting */
-static byte attr_idx_feat[F_LIT_MAX];
+static TERM_COLOR attr_idx_feat[F_LIT_MAX];
 static byte char_idx_feat[F_LIT_MAX];
 
 /*
@@ -6476,10 +6442,11 @@ static byte char_idx_feat[F_LIT_MAX];
  */
 static bool visual_mode_command(char ch, bool *visual_list_ptr,
                                int height, int width,
-                               byte *attr_top_ptr, byte *char_left_ptr,
-                               byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
+                               TERM_COLOR *attr_top_ptr, byte *char_left_ptr,
+                               TERM_COLOR *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
 {
-       static byte attr_old = 0, char_old = 0;
+       static TERM_COLOR attr_old = 0;
+       static byte char_old = 0;
 
        switch (ch)
        {
@@ -6682,10 +6649,11 @@ static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX d
        bool redraw;
 
        bool visual_list = FALSE;
-       byte attr_top = 0, char_left = 0;
+       TERM_COLOR attr_top = 0;
+       byte char_left = 0;
 
        int browser_rows;
-       TERM_POSITION wid, hgt;
+       TERM_LEN wid, hgt;
 
        BIT_FLAGS8 mode;
 
@@ -6937,7 +6905,8 @@ static void display_object_list(int col, int row, int per_page, IDX object_idx[]
        for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
        {
                char o_name[80];
-               byte a, c;
+               TERM_COLOR a;
+               byte c;
                object_kind *flavor_k_ptr;
 
                /* Get the object index */
@@ -7007,7 +6976,7 @@ static void display_object_list(int col, int row, int per_page, IDX object_idx[]
 /*
  * Describe fake object
  */
-static void desc_obj_fake(IDX k_idx)
+static void desc_obj_fake(KIND_OBJECT_IDX k_idx)
 {
        object_type *o_ptr;
        object_type object_type_body;
@@ -7061,7 +7030,8 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
        bool redraw;
 
        bool visual_list = FALSE;
-       byte attr_top = 0, char_left = 0;
+       TERM_COLOR attr_top = 0;
+       byte char_left = 0;
 
        int browser_rows;
        int wid, hgt;
@@ -7422,14 +7392,16 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX d
        bool redraw;
 
        bool visual_list = FALSE;
-       byte attr_top = 0, char_left = 0;
+       TERM_COLOR attr_top = 0;
+       byte char_left = 0;
 
        int browser_rows;
        int wid, hgt;
 
-       byte attr_old[F_LIT_MAX];
+       TERM_COLOR attr_old[F_LIT_MAX];
        byte char_old[F_LIT_MAX];
-       byte *cur_attr_ptr, *cur_char_ptr;
+       TERM_COLOR *cur_attr_ptr;
+       byte *cur_char_ptr;
 
        (void)C_WIPE(attr_old, F_LIT_MAX, byte);
        (void)C_WIPE(char_old, F_LIT_MAX, byte);
@@ -7650,7 +7622,7 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX d
 
                else if ((ch == 'D') || (ch == 'd'))
                {
-                       byte prev_x_attr = f_ptr->x_attr[*lighting_level];
+                       TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level];
                        byte prev_x_char = f_ptr->x_char[*lighting_level];
 
                        apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
@@ -8023,7 +7995,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                                                        artifact_type *a_ptr = &a_info[quest[i].k_idx];
                                                        object_type forge;
                                                        object_type *q_ptr = &forge;
-                                                       IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
+                                                       KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
                                                        object_prep(q_ptr, k_idx);
                                                        q_ptr->name1 = quest[i].k_idx;
                                                        q_ptr->ident = IDENT_STORE;
@@ -8372,7 +8344,7 @@ static void do_cmd_knowledge_home(void)
                if (st_ptr->stock_num)
                {
 #ifdef JP
-                       int x = 1;
+                       TERM_LEN x = 1;
 #endif
                        /* Header with name of the town */
                        fprintf(fff, _("  [ 我が家のアイテム ]\n", "  [Home Inventory]\n"));
@@ -8592,7 +8564,6 @@ void do_cmd_knowledge(void)
                /* Prompt */
                i = inkey();
 
-               /* Done */
                if (i == ESCAPE) break;
                switch (i)
                {
@@ -8722,7 +8693,6 @@ void do_cmd_time(void)
        if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
        else strcpy(day_buf, "*****");
 
-       /* Message */
 #ifdef JP
        msg_format("%s日目, 時刻は%d:%02d %sです。",
                   day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
@@ -8747,7 +8717,6 @@ void do_cmd_time(void)
        /* Open this file */
        fff = my_fopen(buf, "rt");
 
-       /* Oops */
        if (!fff) return;
 
        /* Find this time */
@@ -8798,7 +8767,6 @@ void do_cmd_time(void)
                }
        }
 
-       /* Message */
        msg_print(desc);
 
        /* Close the file */