OSDN Git Service

[Refactor] #37353 window_stuff() の直接呼出しを抑止。 / Forbid call of window_stuff() except...
[hengband/hengband.git] / src / autopick.c
index 013da28..f45c949 100644 (file)
  */
 
 #include "angband.h"
-
+#include "store.h"
 
 #define MAX_LINELEN 1024
 
 /*
  * Macros for Keywords
  */
-#define FLG_ALL              
-#define FLG_UNAWARE         
-#define FLG_UNIDENTIFIED     
-#define FLG_IDENTIFIED      
-#define FLG_STAR_IDENTIFIED  
-#define FLG_COLLECTING      
-#define FLG_ARTIFACT        
+#define FLG_ALL                                0
+#define FLG_UNAWARE                    1
+#define FLG_UNIDENTIFIED       2
+#define FLG_IDENTIFIED         3
+#define FLG_STAR_IDENTIFIED    4
+#define FLG_COLLECTING         5
+#define FLG_ARTIFACT           6
 #define FLG_EGO                     7 
 #define FLG_GOOD            10
-#define FLG_NAMELESS        11
+#define FLG_NAMELESS    11
 #define FLG_AVERAGE         12
-#define FLG_WORTHLESS       13
+#define FLG_WORTHLESS   13
 #define FLG_RARE            14
 #define FLG_COMMON          15
 #define FLG_BOOSTED         16
-#define FLG_MORE_DICE       17
-#define FLG_MORE_BONUS      18 
+#define FLG_MORE_DICE   17
+#define FLG_MORE_BONUS  18
 #define FLG_WANTED          19
 #define FLG_UNIQUE          20
 #define FLG_HUMAN           21
-#define FLG_UNREADABLE      22
+#define FLG_UNREADABLE  22
 #define FLG_REALM1          23
 #define FLG_REALM2          24
 #define FLG_FIRST           25
@@ -273,7 +273,7 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
                        break;
                }
 
-               if (isupper(c)) c = tolower(c);
+               if (isupper(c)) c = (char)tolower(c);
 
                buf[i] = c;
        }
@@ -733,11 +733,7 @@ static void init_autopick(void)
  */
 static cptr pickpref_filename(int filename_mode)
 {
-#ifdef JP
-       static const char namebase[] = "picktype";
-#else
-       static const char namebase[] = "pickpref";
-#endif
+       static const char namebase[] = _("picktype", "pickpref");
 
        switch (filename_mode)
        {
@@ -773,11 +769,7 @@ void autopick_load_pref(bool disp_mes)
        if (err == 0 && disp_mes)
        {
                /* Success */
-#ifdef JP
-               msg_format("%sを読み込みました。", buf);
-#else
-               msg_format("Loaded '%s'.", buf);
-#endif
+               msg_format(_("%sを読み込みました。", "Loaded '%s'."), buf);
        }
 
        /* No file found */
@@ -792,22 +784,14 @@ void autopick_load_pref(bool disp_mes)
                if (err == 0 && disp_mes)
                {
                        /* Success */
-#ifdef JP
-                       msg_format("%sを読み込みました。", buf);
-#else
-                       msg_format("Loaded '%s'.", buf);
-#endif
+                       msg_format(_("%sを読み込みました。", "Loaded '%s'."), buf);
                }
        }
 
        if (err && disp_mes)
        {
                /* Failed */
-#ifdef JP
-               msg_print("自動拾い設定ファイルの読み込みに失敗しました。");
-#else
-               msg_print("Failed to reload autopick preference.");
-#endif
+               msg_print(_("自動拾い設定ファイルの読み込みに失敗しました。", "Failed to reload autopick preference."));
        }
 }
 
@@ -1593,7 +1577,7 @@ static void auto_destroy_item(object_type *o_ptr, int autopick_idx)
 
        /* Now decided to destroy */
 
-       disturb(0,0);
+       disturb(FALSE, FALSE);
 
        /* Artifact? */
        if (!can_player_destroy_object(o_ptr))
@@ -1603,14 +1587,8 @@ static void auto_destroy_item(object_type *o_ptr, int autopick_idx)
                /* Describe the object (with {terrible/special}) */
                object_desc(o_name, o_ptr, 0);
 
-               /* Message */
-#ifdef JP
-               msg_format("%sは破壊不能だ。", o_name);
-#else
-               msg_format("You cannot auto-destroy %s.", o_name);
-#endif
+               msg_format(_("%sは破壊不能だ。", "You cannot auto-destroy %s."), o_name);
 
-               /* Done */
                return;
        }
 
@@ -1628,7 +1606,7 @@ static void auto_destroy_item(object_type *o_ptr, int autopick_idx)
 /*
  *  Auto-destroy marked item
  */
-static void autopick_delayed_alter_aux(int item)
+static void autopick_delayed_alter_aux(INVENTORY_IDX item)
 {
        object_type *o_ptr;
 
@@ -1658,12 +1636,7 @@ static void autopick_delayed_alter_aux(int item)
                        delete_object_idx(0 - item);
                }
 
-               /* Print a message */
-#ifdef JP
-               msg_format("%sを自動破壊します。", o_name);
-#else
-               msg_format("Auto-destroying %s.", o_name);
-#endif
+               msg_format(_("%sを自動破壊します。", "Auto-destroying %s."), o_name);
        }
 }
 
@@ -1673,7 +1646,7 @@ static void autopick_delayed_alter_aux(int item)
  */
 void autopick_delayed_alter(void)
 {
-       int item;
+       INVENTORY_IDX item;
 
        /* 
         * Scan inventry in reverse order to prevent
@@ -1683,10 +1656,10 @@ void autopick_delayed_alter(void)
                autopick_delayed_alter_aux(item);
 
        /* Scan the pile of objects */
-       item = cave[py][px].o_idx;
+       item = cave[p_ptr->y][p_ptr->x].o_idx;
        while (item)
        {
-               int next = o_list[item].next_o_idx;
+               OBJECT_IDX next = o_list[item].next_o_idx;
                autopick_delayed_alter_aux(-item);
                item = next;
        }
@@ -1699,7 +1672,7 @@ void autopick_delayed_alter(void)
  * Auto-destroyer works only on inventory or on floor stack only when
  * requested.
  */
-void autopick_alter_item(int item, bool destroy)
+void autopick_alter_item(INVENTORY_IDX item, bool destroy)
 {
        object_type *o_ptr;
        int idx;
@@ -1727,15 +1700,13 @@ void autopick_alter_item(int item, bool destroy)
  */
 void autopick_pickup_items(cave_type *c_ptr)
 {
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
        
        /* Scan the pile of objects */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                int idx;
-       
-               /* Acquire object */
-               object_type *o_ptr = &o_list[this_o_idx];
+                       object_type *o_ptr = &o_list[this_o_idx];
                
                /* Acquire next object */
                next_o_idx = o_ptr->next_o_idx;
@@ -1748,21 +1719,15 @@ void autopick_pickup_items(cave_type *c_ptr)
                if (idx >= 0 &&
                        (autopick_list[idx].action & (DO_AUTOPICK | DO_QUERY_AUTOPICK)))
                {
-                       disturb(0,0);
+                       disturb(FALSE, FALSE);
 
                        if (!inven_carry_okay(o_ptr))
                        {
                                char o_name[MAX_NLEN];
 
-                               /* Describe the object */
                                object_desc(o_name, o_ptr, 0);
 
-                               /* Message */
-#ifdef JP
-                               msg_format("ザックには%sを入れる隙間がない。", o_name);
-#else
-                               msg_format("You have no room for %s.", o_name);
-#endif
+                               msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
                                /* Hack - remember that the item has given a message here. */
                                o_ptr->marked |= OM_NOMSG;
 
@@ -1779,14 +1744,9 @@ void autopick_pickup_items(cave_type *c_ptr)
                                        continue;
                                }
 
-                               /* Describe the object */
                                object_desc(o_name, o_ptr, 0);
 
-#ifdef JP
-                               sprintf(out_val, "%sを拾いますか? ", o_name);
-#else
-                               sprintf(out_val, "Pick up %s? ", o_name);
-#endif
+                               sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
 
                                if (!get_check(out_val))
                                {
@@ -1851,12 +1811,7 @@ static bool clear_auto_register(void)
        {
                /* Close the preference file */
                fclose(pref_fff);
-
-#ifdef JP
-               msg_format("一時ファイル %s を作成できませんでした。", tmp_file);
-#else
-               msg_format("Failed to create temporary file %s.", tmp_file);
-#endif
+               msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), tmp_file);
                msg_print(NULL);
                return FALSE;
        }
@@ -1898,13 +1853,9 @@ static bool clear_auto_register(void)
 
        if (num)
        {
-#ifdef JP
-               msg_format("以前のキャラクター用の自動設定(%d行)が残っています。", num);
-               strcpy(buf, "古い設定行は削除します。よろしいですか?");
-#else
-               msg_format("Auto registered lines (%d lines) for previous character are remaining.", num);
-               strcpy(buf, "These lines will be deleted.  Are you sure? ");
-#endif
+               msg_format(_("以前のキャラクター用の自動設定(%d行)が残っています。",
+                                        "Auto registered lines (%d lines) for previous character are remaining."), num);
+               strcpy(buf, _("古い設定行は削除します。よろしいですか?", "These lines will be deleted.  Are you sure? "));
 
                /* You can cancel it */
                if (!get_check(buf))
@@ -1912,11 +1863,8 @@ static bool clear_auto_register(void)
                        okay = FALSE;
                        autoregister = FALSE;
 
-#ifdef JP
-                       msg_print("エディタのカット&ペースト等を使って必要な行を避難してください。");
-#else
-                       msg_print("Use cut & paste of auto picker editor (_) to keep old prefs.");
-#endif
+                       msg_print(_("エディタのカット&ペースト等を使って必要な行を避難してください。",
+                                               "Use cut & paste of auto picker editor (_) to keep old prefs."));
                }
        }
 
@@ -1961,22 +1909,12 @@ bool autopick_autoregister(object_type *o_ptr)
                cptr what;
                byte act = autopick_list[match_autopick].action;
 
-#ifdef JP
-               if (act & DO_AUTOPICK) what = "自動で拾う";
-               else if (act & DO_AUTODESTROY) what = "自動破壊する";
-               else if (act & DONT_AUTOPICK) what = "放置する";
-               else /* if (act & DO_QUERY_AUTOPICK) */ what = "確認して拾う";
-
-               msg_format("そのアイテムは既に%sように設定されています。", what);
-#else
-               if (act & DO_AUTOPICK) what = "auto-pickup";
-               else if (act & DO_AUTODESTROY) what = "auto-destroy";
-               else if (act & DONT_AUTOPICK) what = "leave on floor";
-               else /* if (act & DO_QUERY_AUTOPICK) */ what = "query auto-pickup";
+               if (act & DO_AUTOPICK) what = _("自動で拾う", "auto-pickup");
+               else if (act & DO_AUTODESTROY) what = _("自動破壊する", "auto-destroy");
+               else if (act & DONT_AUTOPICK) what = _("放置する", "leave on floor");
+               else /* if (act & DO_QUERY_AUTOPICK) */ what = _("確認して拾う", "query auto-pickup");
 
-               msg_format("The object is already registered to %s.", what);
-#endif
-               
+               msg_format(_("そのアイテムは既に%sように設定されています。", "The object is already registered to %s."), what);
                return FALSE;
        }
 
@@ -1990,14 +1928,8 @@ bool autopick_autoregister(object_type *o_ptr)
                /* Describe the object (with {terrible/special}) */
                object_desc(o_name, o_ptr, 0);
 
-               /* Message */
-#ifdef JP
-               msg_format("%sは破壊不能だ。", o_name);
-#else
-               msg_format("You cannot auto-destroy %s.", o_name);
-#endif
+               msg_format(_("%sは破壊不能だ。", "You cannot auto-destroy %s."), o_name);
 
-               /* Done */
                return FALSE;
        }
 
@@ -2048,11 +1980,7 @@ bool autopick_autoregister(object_type *o_ptr)
 
        /* Failure */
        if (!pref_fff) {
-#ifdef JP
-               msg_format("%s を開くことができませんでした。", pref_file);
-#else
-               msg_format("Failed to open %s.", pref_file);
-#endif
+               msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), pref_file);
                msg_print(NULL);
 
                /* Failed */
@@ -2064,13 +1992,10 @@ bool autopick_autoregister(object_type *o_ptr)
                /* Add the header */
                fprintf(pref_fff, "%s\n", autoregister_header);
 
-#ifdef JP
-               fprintf(pref_fff, "%s\n", "# *警告!!* 以降の行は自動登録されたものです。");
-               fprintf(pref_fff, "%s\n", "# 後で自動的に削除されますので、必要な行は上の方へ移動しておいてください。");
-#else
-               fprintf(pref_fff, "%s\n", "# *Waring!* The lines below will be deleated later.");
-               fprintf(pref_fff, "%s\n", "# Keep it by cut & paste if you need these lines for future characters.");
-#endif
+               fprintf(pref_fff, "%s\n", _("# *警告!!* 以降の行は自動登録されたものです。",
+                                                           "# *Waring!* The lines below will be deleated later."));
+               fprintf(pref_fff, "%s\n", _("# 後で自動的に削除されますので、必要な行は上の方へ移動しておいてください。", 
+                                                           "# Keep it by cut & paste if you need these lines for future characters."));
 
                /* Now auto register is in-use */
                p_ptr->autopick_autoregister = TRUE;
@@ -2849,17 +2774,10 @@ static cptr *read_text_lines(cptr filename)
 static void prepare_default_pickpref(void)
 {
        const cptr messages[] = {
-#ifdef JP
-               "あなたは「自動拾いエディタ」を初めて起動しました。",
-               "自動拾いのユーザー設定ファイルがまだ書かれていないので、",
-               "基本的な自動拾い設定ファイルをlib/pref/picktype.prfからコピーします。",
-               NULL
-#else
-               "You have activated the Auto-Picker Editor for the first time.",
-               "Since user pref file for autopick is not yet created,",
-               "the default setting is loaded from lib/pref/pickpref.prf .",
+               _("あなたは「自動拾いエディタ」を初めて起動しました。", "You have activated the Auto-Picker Editor for the first time."),
+               _("自動拾いのユーザー設定ファイルがまだ書かれていないので、", "Since user pref file for autopick is not yet created,"),
+               _("基本的な自動拾い設定ファイルをlib/pref/picktype.prfからコピーします。", "the default setting is loaded from lib/pref/pickpref.prf ."),
                NULL
-#endif
        };
 
        char buf[1024];
@@ -2997,7 +2915,7 @@ static void free_text_lines(cptr *lines_list)
 /*
  * Delete or insert string
  */
-static void toggle_keyword(text_body_type *tb, int flg)
+static void toggle_keyword(text_body_type *tb, BIT_FLAGS flg)
 {
        int by1, by2, y;
        bool add = TRUE;
@@ -3169,7 +3087,7 @@ static void toggle_command_letter(text_body_type *tb, byte flg)
 /*
  * Delete or insert string
  */
-static void add_keyword(text_body_type *tb, int flg)
+static void add_keyword(text_body_type *tb, BIT_FLAGS flg)
 {
        int by1, by2, y;
 
@@ -3323,7 +3241,7 @@ static bool insert_return_code(text_body_type *tb)
  */
 static object_type *choose_object(cptr q, cptr s)
 {
-       int item;
+       OBJECT_IDX item;
 
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP))) return NULL;
 
@@ -3343,7 +3261,6 @@ static bool entry_from_choosed_object(autopick_type *entry)
        object_type *o_ptr;
        cptr q, s;
 
-       /* Get an item */
 #ifdef JP
        q = "どのアイテムを登録しますか? ";
        s = "アイテムを持っていない。";
@@ -3368,7 +3285,6 @@ static byte get_object_for_search(object_type **o_handle, cptr *search_strp)
        object_type *o_ptr;
        cptr q, s;
 
-       /* Get an item */
 #ifdef JP
        q = "どのアイテムを検索しますか? ";
        s = "アイテムを持っていない。";
@@ -3422,11 +3338,7 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
        char buf[MAX_NLEN+20];
        const int len = 80;
 
-#ifdef JP
-       char prompt[] = "検索(^I:持ち物 ^L:破壊された物): ";
-#else
-       char prompt[] = "Search key(^I:inven ^L:destroyed): ";
-#endif
+       char prompt[] = _("検索(^I:持ち物 ^L:破壊された物): ", "Search key(^I:inven ^L:destroyed): ");
        int col = sizeof(prompt) - 1;
 
        /* Prepare string buffer for edit */
@@ -3529,7 +3441,6 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
                        return (back ? -1 : 1);
 
                case KTRL('i'):
-                       /* Get an item */
                        return get_object_for_search(o_handle, search_strp);
 
                case KTRL('l'):
@@ -3872,11 +3783,11 @@ static void search_for_string(text_body_type *tb, cptr search_str, bool forward)
 /*
  * Editor command id's
  */
-#define EC_QUIT                1 
-#define EC_SAVEQUIT            2     
-#define EC_REVERT             3 
-#define EC_HELP                4 
-#define EC_RETURN             5        
+#define EC_QUIT            1
+#define EC_SAVEQUIT        2
+#define EC_REVERT             3
+#define EC_HELP            4
+#define EC_RETURN             5
 #define EC_LEFT                       6 
 #define EC_DOWN                       7 
 #define EC_UP                 8 
@@ -4309,11 +4220,7 @@ static int do_command_menu(int level, int start)
 
                                if (menu_data[i].com_id == -1)
                                {
-#ifdef JP
-                                       strcpy(com_key_str, "▼");
-#else
-                                       strcpy(com_key_str, ">");
-#endif
+                                       strcpy(com_key_str, _("▼", ">"));
                                }
                                else if (menu_data[i].key != -1)
                                {
@@ -4339,11 +4246,7 @@ static int do_command_menu(int level, int start)
                        /* The menu was shown */
                        redraw = FALSE;
                }
-#ifdef JP
-               prt(format("(a-%c) コマンド:", menu_key + 'a' - 1), 0, 0);
-#else
-               prt(format("(a-%c) Command:", menu_key + 'a' - 1), 0, 0);
-#endif
+               prt(format(_("(a-%c) コマンド:", "(a-%c) Command:"), menu_key + 'a' - 1), 0, 0);
                key = inkey();
 
                if (key == ESCAPE) return 0;
@@ -4536,7 +4439,6 @@ static void draw_text_editor(text_body_type *tb)
        int i;
        int by1 = 0, by2 = 0;
 
-       /* Get size */
        Term_get_size(&tb->wid, &tb->hgt);
 
        /*
@@ -4762,76 +4664,41 @@ static void draw_text_editor(text_body_type *tb)
                /* Display information */
                if (tb->dirty_flags & DIRTY_NOT_FOUND)
                {
-#ifdef JP
-                       str1 = format("パターンが見つかりません: %s", tb->search_str);
-#else
-                       str1 = format("Pattern not found: %s", tb->search_str);
-#endif
+                       str1 = format(_("パターンが見つかりません: %s", "Pattern not found: %s"), tb->search_str);
                }
                else if (tb->dirty_flags & DIRTY_SKIP_INACTIVE)
                {
-#ifdef JP
-                       str1 = format("無効状態の行をスキップしました。(%sを検索中)", tb->search_str);
-#else
-                       str1 = format("Some inactive lines are skipped. (Searching %s)", tb->search_str);
-#endif
+                       str1 = format(_("無効状態の行をスキップしました。(%sを検索中)", 
+                                                       "Some inactive lines are skipped. (Searching %s)"), tb->search_str);
                }
                else if (tb->dirty_flags & DIRTY_INACTIVE)
                {
-#ifdef JP
-                       str1 = format("無効状態の行だけが見付かりました。(%sを検索中)", tb->search_str);
-#else
-                       str1 = format("Found only an inactive line. (Searching %s)", tb->search_str);
-#endif
+                       str1 = format(_("無効状態の行だけが見付かりました。(%sを検索中)",
+                                                       "Found only an inactive line. (Searching %s)"), tb->search_str);
                }
                else if (tb->dirty_flags & DIRTY_NO_SEARCH)
                {
-#ifdef JP
-                       str1 = "検索するパターンがありません(^S で検索)。";
-#else
-                       str1 = "No pattern to search. (Press ^S to search.)";
-#endif
+                       str1 = _("検索するパターンがありません(^S で検索)。", "No pattern to search. (Press ^S to search.)");
                }
                else if (tb->lines_list[tb->cy][0] == '#')
                {
-#ifdef JP
-                       str1 = "この行はコメントです。";
-#else
-                       str1 = "This line is a comment.";
-#endif
+                       str1 = _("この行はコメントです。", "This line is a comment.");
                }
                else if (tb->lines_list[tb->cy][0] && tb->lines_list[tb->cy][1] == ':')
                {
                        switch(tb->lines_list[tb->cy][0])
                        {
                        case '?':
-#ifdef JP
-                               str1 = "この行は条件分岐式です。";
-#else
-                               str1 = "This line is a Conditional Expression.";
-#endif
-
+                               str1 = _("この行は条件分岐式です。", "This line is a Conditional Expression.");
                                break;
                        case 'A':
-#ifdef JP
-                               str1 = "この行はマクロの実行内容を定義します。";
-#else
-                               str1 = "This line defines a Macro action.";
-#endif
+                               str1 = _("この行はマクロの実行内容を定義します。", "This line defines a Macro action.");
                                break;
                        case 'P':
-#ifdef JP
-                               str1 = "この行はマクロのトリガー・キーを定義します。";
-#else
-                               str1 = "This line defines a Macro trigger key.";
-#endif
+                               str1 = _("この行はマクロのトリガー・キーを定義します。", "This line defines a Macro trigger key.");
                                break;
                        case 'C':
-#ifdef JP
-                               str1 = "この行はキー配置を定義します。";
-#else
-                               str1 = "This line defines a Keymap.";
-#endif
+                               str1 = _("この行はキー配置を定義します。", "This line defines a Keymap.");
                                break;
                        }
 
@@ -4840,39 +4707,23 @@ static void draw_text_editor(text_body_type *tb)
                        case '?':
                                if (tb->states[tb->cy] & LSTAT_BYPASS)
                                {
-#ifdef JP
-                                       str2 = "現在の式の値は「偽(=0)」です。";
-#else
-                                       str2 = "The expression is 'False'(=0) currently.";
-#endif
+                                       str2 = _("現在の式の値は「偽(=0)」です。", "The expression is 'False'(=0) currently.");
                                }
                                else
                                {
-#ifdef JP
-                                       str2 = "現在の式の値は「真(=1)」です。";
-#else
-                                       str2 = "The expression is 'True'(=1) currently.";
-#endif
+                                       str2 = _("現在の式の値は「真(=1)」です。", "The expression is 'True'(=1) currently.");
                                }
                                break;
 
                        default:
                                if (tb->states[tb->cy] & LSTAT_AUTOREGISTER)
                                {
-#ifdef JP
-                                       str2 = "この行は後で削除されます。";
-#else
-                                       str2 = "This line will be delete later.";
-#endif
+                                       str2 = _("この行は後で削除されます。", "This line will be delete later.");
                                }
 
                                else if (tb->states[tb->cy] & LSTAT_BYPASS)
                                {
-#ifdef JP
-                                       str2 = "この行は現在は無効な状態です。";
-#else
-                                       str2 = "This line is bypassed currently.";
-#endif
+                                       str2 = _("この行は現在は無効な状態です。", "This line is bypassed currently.");
                                }
                                break;
                        }
@@ -4889,20 +4740,12 @@ static void draw_text_editor(text_body_type *tb)
 
                        if (tb->states[tb->cy] & LSTAT_AUTOREGISTER)
                        {
-#ifdef JP
-                               strcat(buf, "この行は後で削除されます。");
-#else
-                               strcat(buf, "  This line will be delete later.");
-#endif
+                               strcat(buf, _("この行は後で削除されます。", "  This line will be delete later."));
                        }
 
                        if (tb->states[tb->cy] & LSTAT_BYPASS)
                        {
-#ifdef JP
-                               strcat(buf, "この行は現在は無効な状態です。");
-#else
-                               strcat(buf, "  This line is bypassed currently.");
-#endif
+                               strcat(buf, _("この行は現在は無効な状態です。", "  This line is bypassed currently."));
                        }
 
                        roff_to_buf(buf, 81, temp, sizeof(temp));
@@ -5004,7 +4847,7 @@ static bool insert_macro_line(text_body_type *tb)
        while (i)
        {
                /* Save the key */
-               buf[n++] = i;
+               buf[n++] = (char)i;
 
                /* Do not process macros */
                inkey_base = TRUE;
@@ -5019,7 +4862,6 @@ static bool insert_macro_line(text_body_type *tb)
        /* Terminate */
        buf[n] = '\0';
 
-       /* Flush */
        flush();
 
        /* Convert the trigger */
@@ -5065,7 +4907,7 @@ static bool insert_keymap_line(text_body_type *tb)
 {
        char tmp[1024];
        char buf[2];
-       int mode;
+       BIT_FLAGS mode;
        cptr act;
 
        /* Roguelike */
@@ -5080,14 +4922,12 @@ static bool insert_keymap_line(text_body_type *tb)
                mode = KEYMAP_MODE_ORIG;
        }
 
-       /* Flush */
        flush();
 
        /* Get a key */
        buf[0] = inkey();
        buf[1] = '\0';
 
-       /* Flush */
        flush();
 
        /* Convert the trigger */
@@ -5137,11 +4977,8 @@ static bool do_editor_command(text_body_type *tb, int com_id)
        case EC_QUIT:
                if (tb->changed)
                {
-#ifdef JP
-                       if (!get_check("全ての変更を破棄してから終了します。よろしいですか? ")) break;
-#else
-                       if (!get_check("Discard all changes and quit. Are you sure? ")) break;
-#endif
+                       if (!get_check(_("全ての変更を破棄してから終了します。よろしいですか? ",
+                                                        "Discard all changes and quit. Are you sure? "))) break;
                }
                return QUIT_WITHOUT_SAVE;
 
@@ -5150,11 +4987,8 @@ static bool do_editor_command(text_body_type *tb, int com_id)
 
        case EC_REVERT:
                /* Revert to original */
-#ifdef JP
-               if (!get_check("全ての変更を破棄して元の状態に戻します。よろしいですか? ")) break;
-#else
-               if (!get_check("Discard all changes and revert to original file. Are you sure? ")) break;
-#endif
+               if (!get_check(_("全ての変更を破棄して元の状態に戻します。よろしいですか? ",
+                                                "Discard all changes and revert to original file. Are you sure? "))) break;
 
                free_text_lines(tb->lines_list);
                tb->lines_list = read_pickpref_text_lines(&tb->filename_mode);
@@ -5168,11 +5002,7 @@ static bool do_editor_command(text_body_type *tb, int com_id)
 
        case EC_HELP:
                /* Peruse the main help file */
-#ifdef JP
-               (void)show_file(TRUE, "jeditor.txt", NULL, 0, 0);
-#else
-               (void)show_file(TRUE, "editor.txt", NULL, 0, 0);
-#endif
+               (void)show_file(TRUE, _("jeditor.txt", "editor.txt"), NULL, 0, 0);
                /* Redraw all */
                tb->dirty_flags |= DIRTY_SCREEN;
 
@@ -5902,11 +5732,7 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                Term_erase(0, tb->cy - tb->upper + 1, tb->wid);
 
                /* Prompt */
-#ifdef JP
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, "P:<トリガーキー>: ");
-#else
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, "P:<Trigger key>: ");
-#endif
+               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, _("P:<トリガーキー>: ", "P:<Trigger key>: "));
                if (insert_macro_line(tb))
                {
                        /* Prepare to input action */
@@ -5929,11 +5755,8 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                Term_erase(0, tb->cy - tb->upper + 1, tb->wid);
 
                /* Prompt */
-#ifdef JP
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, format("C:%d:<コマンドキー>: ", (rogue_like_commands ? KEYMAP_MODE_ROGUE : KEYMAP_MODE_ORIG)));
-#else
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, format("C:%d:<Keypress>: ", (rogue_like_commands ? KEYMAP_MODE_ROGUE : KEYMAP_MODE_ORIG)));
-#endif
+               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, 
+                                       format(_("C:%d:<コマンドキー>: ", "C:%d:<Keypress>: "), (rogue_like_commands ? KEYMAP_MODE_ROGUE : KEYMAP_MODE_ORIG)));
 
                if (insert_keymap_line(tb))
                {
@@ -6050,8 +5873,8 @@ static void insert_single_letter(text_body_type *tb, int key)
                next = inkey();
                if (j+2 < MAX_LINELEN)
                {
-                       buf[j++] = key;
-                       buf[j++] = next;
+                       buf[j++] = (char)key;
+                       buf[j++] = (char)next;
                        tb->cx += 2;
                }
                else
@@ -6061,7 +5884,7 @@ static void insert_single_letter(text_body_type *tb, int key)
 #endif
        {
                if (j+1 < MAX_LINELEN)
-                       buf[j++] = key;
+                       buf[j++] = (char)key;
                tb->cx++;
        }
 
@@ -6250,11 +6073,8 @@ void do_cmd_edit_autopick(void)
                draw_text_editor(tb);
 
                /* Display header line */
-#ifdef JP
-               prt("(^Q:終了 ^W:セーブして終了, ESC:メニュー, その他:入力)", 0, 0);
-#else  
-               prt("(^Q:Quit, ^W:Save&Quit, ESC:Menu, Other:Input text)", 0, 0);
-#endif
+               prt(_("(^Q:終了 ^W:セーブして終了, ESC:メニュー, その他:入力)", 
+                     "(^Q:Quit, ^W:Save&Quit, ESC:Menu, Other:Input text)"), 0, 0);
                if (!tb->mark)
                {
                        /* Display current position */
@@ -6320,7 +6140,7 @@ void do_cmd_edit_autopick(void)
                /* Other commands */
                else
                {
-                       com_id = get_com_id(key);
+                       com_id = get_com_id((char)key);
                }
 
                if (com_id) quit = do_editor_command(tb, com_id);
@@ -6347,7 +6167,7 @@ void do_cmd_edit_autopick(void)
        process_autopick_file(buf);
 
        /* HACK -- reset start_time so that playtime is not increase while edit */
-       start_time = time(NULL);
+       start_time = (u32b)time(NULL);
 
        /* Save cursor location */
        cx_save = tb->cx;