OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / autopick.c
index c1ea955..4842360 100644 (file)
@@ -1,13 +1,14 @@
-/* File: autopick.c */
-
-/* Purpose: Object Auto-picker/Destroyer */
-
-/*
- * Copyright (c) 2002  Mogami
- *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+/*!
+ * @file autopick.c
+ * @brief 自動拾い機能の実装 / Object Auto-picker/Destroyer
+ * @date 2014/01/02
+ * @author
+ * Copyright (c) 2002  Mogami\n
+ *\n
+ * This software may be copied and distributed for educational, research, and\n
+ * not for profit purposes provided that this copyright and statement are\n
+ * included in all such copies.\n
+ * 2014 Deskull rearranged comment for Doxygen.\n
  */
 
 #include "angband.h"
 /*
  * Macros for Keywords
  */
-#define FLG_ALL              0
-#define FLG_COLLECTING      1
-#define FLG_UNAWARE         2 
-#define FLG_UNIDENTIFIED     3 
-#define FLG_IDENTIFIED      4 
-#define FLG_STAR_IDENTIFIED  5 
-#define FLG_BOOSTED         6 
-#define FLG_MORE_DICE       7 
-#define FLG_MORE_BONUS      10 
-#define FLG_WORTHLESS       11
-#define FLG_ARTIFACT        12
-#define FLG_EGO                     13
-#define FLG_NAMELESS        14
-#define FLG_RARE            15
-#define FLG_COMMON          16
-#define FLG_WANTED          17
-#define FLG_UNIQUE          18
-#define FLG_HUMAN           19
-#define FLG_UNREADABLE      20
-#define FLG_REALM1          21
-#define FLG_REALM2          22
-#define FLG_FIRST           23
-#define FLG_SECOND          24
-#define FLG_THIRD           25
-#define FLG_FOURTH          26
+#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_AVERAGE         12
+#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_WANTED          19
+#define FLG_UNIQUE          20
+#define FLG_HUMAN           21
+#define FLG_UNREADABLE      22
+#define FLG_REALM1          23
+#define FLG_REALM2          24
+#define FLG_FIRST           25
+#define FLG_SECOND          26
+#define FLG_THIRD           27
+#define FLG_FOURTH          28
 
 #define FLG_ITEMS           30
 #define FLG_WEAPONS         31
 
 #ifdef JP
 
-#define KEY_ALL "¤¹¤Ù¤Æ¤Î"
-
-#ifdef MAC_MPW
-/*
- * MEGA HACK -- MPW¤Î¥Ð¥°½ü¤±¡£
- * pre-processÃæ¤Ë¡Ö¼ý¡×¤Î»ú¤Î2¥Ð¥¤¥ÈÌܤ¬¾¡¼ê¤Ë¾Ã¤¨¤Æ¤·¤Þ¤¦¡£
- */
-#define KEY_COLLECTING "\x8e\xfb½¸Ãæ¤Î"
-#else
-#define KEY_COLLECTING "¼ý½¸Ãæ¤Î"
-#endif
-
-#define KEY_UNAWARE "̤ȽÌÀ¤Î"
-#define KEY_UNIDENTIFIED "̤´ÕÄê¤Î"
-#define KEY_IDENTIFIED "´ÕÄêºÑ¤ß¤Î"
-#define KEY_STAR_IDENTIFIED "*´ÕÄê*ºÑ¤ß¤Î"
-#define KEY_BOOSTED "¥À¥¤¥¹Ìܤΰ㤦"
-#define KEY_MORE_THAN  "¥À¥¤¥¹ÌÜ"
-#define KEY_DICE  "°Ê¾å¤Î"
-#define KEY_MORE_BONUS  "½¤ÀµÃÍ"
-#define KEY_MORE_BONUS2  "°Ê¾å¤Î"
-#define KEY_WORTHLESS "̵²ÁÃͤÎ"
-#define KEY_ARTIFACT "¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È"
-#define KEY_EGO "¥¨¥´"
-#define KEY_NAMELESS "̵ÌäÎ"
-#define KEY_RARE "¥ì¥¢¤Ê"
-#define KEY_COMMON "¤¢¤ê¤Õ¤ì¤¿"
-#define KEY_WANTED "¾Þ¶â¼ó¤Î"
-#define KEY_UNIQUE "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î"
-#define KEY_HUMAN "¿Í´Ö¤Î"
-#define KEY_UNREADABLE "Æɤá¤Ê¤¤"
-#define KEY_REALM1 "Âè°ìÎΰè¤Î"
-#define KEY_REALM2 "ÂèÆóÎΰè¤Î"
-#define KEY_FIRST "1ºýÌܤÎ"
-#define KEY_SECOND "2ºýÌܤÎ"
-#define KEY_THIRD "3ºýÌܤÎ"
-#define KEY_FOURTH "4ºýÌܤÎ"
-#define KEY_ITEMS "¥¢¥¤¥Æ¥à"
-#define KEY_WEAPONS "Éð´ï"
-#define KEY_FAVORITE_WEAPONS "ÆÀ°ÕÉð´ï"
-#define KEY_ARMORS "Ëɶñ"
-#define KEY_MISSILES "Ìð"
-#define KEY_DEVICES "ËâË¡¥¢¥¤¥Æ¥à"
-#define KEY_LIGHTS "¸÷¸»"
-#define KEY_JUNKS "¤¬¤é¤¯¤¿"
-#define KEY_CORPSES "»àÂΤä¹ü"
-#define KEY_SPELLBOOKS "ËâË¡½ñ"
-#define KEY_HAFTED "Æß´ï"
-#define KEY_SHIELDS "½â"
-#define KEY_BOWS "µÝ"
-#define KEY_RINGS "»ØÎØ"
-#define KEY_AMULETS "¥¢¥ß¥å¥ì¥Ã¥È"
-#define KEY_SUITS "³»"
-#define KEY_CLOAKS "¥¯¥í¡¼¥¯"
-#define KEY_HELMS "³õ"
-#define KEY_GLOVES "äƼê"
-#define KEY_BOOTS "·¤"
+static char KEY_ALL[] = "すべての";
+static char KEY_UNAWARE[] = "未判明の";
+static char KEY_UNIDENTIFIED[] = "未鑑定の";
+static char KEY_IDENTIFIED[] = "鑑定済みの";
+static char KEY_STAR_IDENTIFIED[] = "*鑑定*済みの";
+static char KEY_COLLECTING[] = "収集中の";
+static char KEY_ARTIFACT[] = "アーティファクト";
+static char KEY_EGO[] = "エゴ";
+static char KEY_GOOD[] = "上質の";
+static char KEY_NAMELESS[] = "無銘の";
+static char KEY_AVERAGE[] = "並の";
+static char KEY_WORTHLESS[] = "無価値の";
+static char KEY_RARE[] = "レアな";
+static char KEY_COMMON[] = "ありふれた";
+static char KEY_BOOSTED[] = "ダイス目の違う";
+static char KEY_MORE_THAN[] =  "ダイス目";
+static char KEY_DICE[] =  "以上の";
+static char KEY_MORE_BONUS[] =  "修正値";
+static char KEY_MORE_BONUS2[] =  "以上の";
+static char KEY_WANTED[] = "賞金首の";
+static char KEY_UNIQUE[] = "ユニーク・モンスターの";
+static char KEY_HUMAN[] = "人間の";
+static char KEY_UNREADABLE[] = "読めない";
+static char KEY_REALM1[] = "第一領域の";
+static char KEY_REALM2[] = "第二領域の";
+static char KEY_FIRST[] = "1冊目の";
+static char KEY_SECOND[] = "2冊目の";
+static char KEY_THIRD[] = "3冊目の";
+static char KEY_FOURTH[] = "4冊目の";
+static char KEY_ITEMS[] = "アイテム";
+static char KEY_WEAPONS[] = "武器";
+static char KEY_FAVORITE_WEAPONS[] = "得意武器";
+static char KEY_ARMORS[] = "防具";
+static char KEY_MISSILES[] = "矢";
+static char KEY_DEVICES[] = "魔法アイテム";
+static char KEY_LIGHTS[] = "光源";
+static char KEY_JUNKS[] = "がらくた";
+static char KEY_CORPSES[] = "死体や骨";
+static char KEY_SPELLBOOKS[] = "魔法書";
+static char KEY_HAFTED[] = "鈍器";
+static char KEY_SHIELDS[] = "盾";
+static char KEY_BOWS[] = "弓";
+static char KEY_RINGS[] = "指輪";
+static char KEY_AMULETS[] = "アミュレット";
+static char KEY_SUITS[] = "鎧";
+static char KEY_CLOAKS[] = "クローク";
+static char KEY_HELMS[] = "兜";
+static char KEY_GLOVES[] = "籠手";
+static char KEY_BOOTS[] = "靴";
 
 #else 
 
-#define KEY_ALL "all"
-#define KEY_COLLECTING "collecting"
-#define KEY_UNAWARE "unaware"
-#define KEY_UNIDENTIFIED "unidentified"
-#define KEY_IDENTIFIED "identified"
-#define KEY_STAR_IDENTIFIED "*identified*"
-#define KEY_BOOSTED "dice boosted"
-#define KEY_MORE_THAN  "more than"
-#define KEY_DICE  " dice"
-#define KEY_MORE_BONUS  "more bonus than"
-#define KEY_MORE_BONUS2  ""
-#define KEY_WORTHLESS "worthless"
-#define KEY_ARTIFACT "artifact"
-#define KEY_EGO "ego"
-#define KEY_NAMELESS "nameless"
-#define KEY_RARE "rare"
-#define KEY_COMMON "common"
-#define KEY_WANTED "wanted"
-#define KEY_UNIQUE "unique monster's"
-#define KEY_HUMAN "human"
-#define KEY_UNREADABLE "unreadable"
-#define KEY_REALM1 "first realm's"
-#define KEY_REALM2 "second realm's"
-#define KEY_FIRST "first"
-#define KEY_SECOND "second"
-#define KEY_THIRD "third"
-#define KEY_FOURTH "fourth"
-#define KEY_ITEMS "items"
-#define KEY_WEAPONS "weapons"
-#define KEY_FAVORITE_WEAPONS "favorite weapons"
-#define KEY_ARMORS "armors"
-#define KEY_MISSILES "missiles"
-#define KEY_DEVICES "magical devices"
-#define KEY_LIGHTS "lights"
-#define KEY_JUNKS "junks"
-#define KEY_CORPSES "corpses or skeletons"
-#define KEY_SPELLBOOKS "spellbooks"
-#define KEY_HAFTED "hafted weapons"
-#define KEY_SHIELDS "shields"
-#define KEY_BOWS "bows"
-#define KEY_RINGS "rings"
-#define KEY_AMULETS "amulets"
-#define KEY_SUITS "suits"
-#define KEY_CLOAKS "cloaks"
-#define KEY_HELMS "helms"
-#define KEY_GLOVES "gloves"
-#define KEY_BOOTS "boots"
+static char KEY_ALL[] = "all";
+static char KEY_UNAWARE[] = "unaware";
+static char KEY_UNIDENTIFIED[] = "unidentified";
+static char KEY_IDENTIFIED[] = "identified";
+static char KEY_STAR_IDENTIFIED[] = "*identified*";
+static char KEY_COLLECTING[] = "collecting";
+static char KEY_ARTIFACT[] = "artifact";
+static char KEY_EGO[] = "ego";
+static char KEY_GOOD[] = "good";
+static char KEY_NAMELESS[] = "nameless";
+static char KEY_AVERAGE[] = "average";
+static char KEY_WORTHLESS[] = "worthless";
+static char KEY_RARE[] = "rare";
+static char KEY_COMMON[] = "common";
+static char KEY_BOOSTED[] = "dice boosted";
+static char KEY_MORE_THAN[] =  "more than";
+static char KEY_DICE[] =  " dice";
+static char KEY_MORE_BONUS[] =  "more bonus than";
+static char KEY_MORE_BONUS2[] =  "";
+static char KEY_WANTED[] = "wanted";
+static char KEY_UNIQUE[] = "unique monster's";
+static char KEY_HUMAN[] = "human";
+static char KEY_UNREADABLE[] = "unreadable";
+static char KEY_REALM1[] = "first realm's";
+static char KEY_REALM2[] = "second realm's";
+static char KEY_FIRST[] = "first";
+static char KEY_SECOND[] = "second";
+static char KEY_THIRD[] = "third";
+static char KEY_FOURTH[] = "fourth";
+static char KEY_ITEMS[] = "items";
+static char KEY_WEAPONS[] = "weapons";
+static char KEY_FAVORITE_WEAPONS[] = "favorite weapons";
+static char KEY_ARMORS[] = "armors";
+static char KEY_MISSILES[] = "missiles";
+static char KEY_DEVICES[] = "magical devices";
+static char KEY_LIGHTS[] = "lights";
+static char KEY_JUNKS[] = "junks";
+static char KEY_CORPSES[] = "corpses or skeletons";
+static char KEY_SPELLBOOKS[] = "spellbooks";
+static char KEY_HAFTED[] = "hafted weapons";
+static char KEY_SHIELDS[] = "shields";
+static char KEY_BOWS[] = "bows";
+static char KEY_RINGS[] = "rings";
+static char KEY_AMULETS[] = "amulets";
+static char KEY_SUITS[] = "suits";
+static char KEY_CLOAKS[] = "cloaks";
+static char KEY_HELMS[] = "helms";
+static char KEY_GLOVES[] = "gloves";
+static char KEY_BOOTS[] = "boots";
 
 #endif /* JP */
 
 #define IS_FLG(FLG) (entry->flag[FLG / 32] & (1L << (FLG % 32)))
 
 #ifdef JP
-       static char kanji_colon[] = "¡§";
+       static char kanji_colon[] = "";
 #endif
 
 
@@ -214,7 +211,7 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
        cptr prev_ptr, ptr, old_ptr;
        int prev_flg;
 
-       if (str[1] == ':') switch (str[0])
+       if (str[0] && str[1] == ':') switch (str[0])
        {
        case '?': case '%':
        case 'A': case 'P': case 'C':
@@ -223,6 +220,7 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
 
        entry->flag[0] = entry->flag[1] = 0L;
        entry->dice = 0;
+       entry->bonus = 0;
 
        act = DO_AUTOPICK | DO_DISPLAY;
        while (TRUE)
@@ -275,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;
        }
@@ -348,7 +346,11 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
 
                        if (k > 0 && k <= 2)
                        {
+#ifdef JP
                                (void)MATCH_KEY(KEY_MORE_BONUS2);
+#else
+                               if (' ' == *ptr) ptr++;
+#endif
                                ADD_FLG(FLG_MORE_BONUS);
                        }
                        else
@@ -357,7 +359,9 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
 
                if (MATCH_KEY(KEY_WORTHLESS)) ADD_FLG(FLG_WORTHLESS);
                if (MATCH_KEY(KEY_EGO)) ADD_FLG(FLG_EGO);
+               if (MATCH_KEY(KEY_GOOD)) ADD_FLG(FLG_GOOD);
                if (MATCH_KEY(KEY_NAMELESS)) ADD_FLG(FLG_NAMELESS);
+               if (MATCH_KEY(KEY_AVERAGE)) ADD_FLG(FLG_AVERAGE);
                if (MATCH_KEY(KEY_RARE)) ADD_FLG(FLG_RARE);
                if (MATCH_KEY(KEY_COMMON)) ADD_FLG(FLG_COMMON);
                if (MATCH_KEY(KEY_WANTED)) ADD_FLG(FLG_WANTED);
@@ -434,134 +438,6 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
 
 
 /*
- * Favorite weapons
- */
-static bool is_favorite(object_type *o_ptr)
-{
-       /* Only melee weapons match */
-       if (!(o_ptr->tval == TV_POLEARM ||
-             o_ptr->tval == TV_SWORD ||
-             o_ptr->tval == TV_DIGGING ||
-             o_ptr->tval == TV_HAFTED))
-       {
-               return FALSE;
-       }
-
-       /* Favorite weapons are varied depend on the class */
-       switch (p_ptr->pclass)
-       {
-       case CLASS_PRIEST:
-       {
-               u32b flgs[TR_FLAG_SIZE];
-               object_flags_known(o_ptr, flgs);
-
-               if (!have_flag(flgs, TR_BLESSED) && 
-                   !(o_ptr->tval == TV_HAFTED))
-                       return FALSE;
-               break;
-       }
-
-       case CLASS_MONK:
-       case CLASS_FORCETRAINER:
-               /* Icky to wield? */
-               if (!(s_info[p_ptr->pclass].w_max[o_ptr->tval-TV_WEAPON_BEGIN][o_ptr->sval]))
-                       return FALSE;
-               break;
-
-       case CLASS_BEASTMASTER:
-       case CLASS_CAVALRY:
-       {
-               u32b flgs[TR_FLAG_SIZE];
-               object_flags_known(o_ptr, flgs);
-
-               /* Is it known to be suitable to using while riding? */
-               if (!(have_flag(flgs, TR_RIDING)))
-                       return FALSE;
-
-               break;
-       }
-
-       case CLASS_NINJA:
-               /* Icky to wield? */
-               if (s_info[p_ptr->pclass].w_max[o_ptr->tval-TV_WEAPON_BEGIN][o_ptr->sval] <= WEAPON_EXP_BEGINNER)
-                       return FALSE;
-               break;
-
-       default:
-               /* All weapons are okay for non-special classes */
-               return TRUE;
-       }
-
-       return TRUE;
-}
-
-
-/*
- * Rare weapons/aromors
- * including Blade of Chaos, Dragon armors, etc.
- */
-static bool is_rare(object_type *o_ptr)
-{
-       switch(o_ptr->tval)
-       {
-       case TV_HAFTED:
-               if (o_ptr->sval == SV_MACE_OF_DISRUPTION ||
-                   o_ptr->sval == SV_WIZSTAFF) return TRUE;
-               break;
-
-       case TV_POLEARM:
-               if (o_ptr->sval == SV_SCYTHE_OF_SLICING ||
-                   o_ptr->sval == SV_DEATH_SCYTHE) return TRUE;
-               break;
-
-       case TV_SWORD:
-               if (o_ptr->sval == SV_BLADE_OF_CHAOS ||
-                   o_ptr->sval == SV_DIAMOND_EDGE ||
-                   o_ptr->sval == SV_DOKUBARI ||
-                   o_ptr->sval == SV_HAYABUSA) return TRUE;
-               break;
-
-       case TV_SHIELD:
-               if (o_ptr->sval == SV_DRAGON_SHIELD ||
-                   o_ptr->sval == SV_MIRROR_SHIELD) return TRUE;
-               break;
-
-       case TV_HELM:
-               if (o_ptr->sval == SV_DRAGON_HELM) return TRUE;
-               break;
-
-       case TV_BOOTS:
-               if (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) return TRUE;
-               break;
-
-       case TV_CLOAK:
-               if (o_ptr->sval == SV_ELVEN_CLOAK ||
-                   o_ptr->sval == SV_ETHEREAL_CLOAK ||
-                   o_ptr->sval == SV_SHADOW_CLOAK) return TRUE;
-               break;
-
-       case TV_GLOVES:
-               if (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) return TRUE;
-               break;
-
-       case TV_SOFT_ARMOR:
-               if (o_ptr->sval == SV_KUROSHOUZOKU ||
-                   o_ptr->sval == SV_ABUNAI_MIZUGI) return TRUE;
-               break;
-
-       case TV_DRAG_ARMOR:
-               return TRUE;
-
-       default:
-               break;
-       }
-
-       /* Any others are not "rare" objects. */
-       return FALSE;
-}
-
-
-/*
  * Get auto-picker entry from o_ptr.
  */
 static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
@@ -570,7 +446,7 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        bool name = TRUE;
 
 #ifdef JP
-       /* ¥¨¥´Ì䬼ÙË⤫¤â¤·¤ì¤Ê¤¤¤Î¤Ç¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¡Ö^¡×¤ÏÉÕ¤±¤Ê¤¤ */
+       /* エゴ銘が邪魔かもしれないので、デフォルトで「^」は付けない */
        bool bol_mark = FALSE;
 #else
        /* We can always use the ^ mark in English */
@@ -588,14 +464,14 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        entry->dice = 0;
 
        /* Unaware */
-       if (!object_aware_p(o_ptr))
+       if (!object_is_aware(o_ptr))
        {
                ADD_FLG(FLG_UNAWARE);
                bol_mark = TRUE;
        }
 
        /* Not really identified */
-       else if (!object_known_p(o_ptr))
+       else if (!object_is_known(o_ptr))
        {
                if (!(o_ptr->ident & IDENT_SENSE))
                {
@@ -645,11 +521,9 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        else
        {
                /* Ego objects */
-               if (o_ptr->name2)
-                   
+               if (object_is_ego(o_ptr))
                {
-                       if (TV_WEAPON_BEGIN <= o_ptr->tval &&
-                           o_ptr->tval <= TV_ARMOR_END)
+                       if (object_is_weapon_armour_ammo(o_ptr))
                        {
                                /*
                                 * Base name of ego weapons and armors
@@ -658,7 +532,7 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
                                 */
                                ego_item_type *e_ptr = &e_info[o_ptr->name2];
 #ifdef JP
-                               /* ¥¨¥´ÌäˤϡÖ^¡×¥Þ¡¼¥¯¤¬»È¤¨¤ë */
+                               /* エゴ銘には「^」マークが使える */
                                sprintf(name_str, "^%s", e_name + e_ptr->name);
 #else
                                /* We ommit the basename and cannot use the ^ mark */
@@ -668,26 +542,22 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
                                /* Don't use the object description */
                                name = FALSE;
 
-                               if (TV_WEAPON_BEGIN <= o_ptr->tval &&
-                                   o_ptr->tval <= TV_ARMOR_END)
-                               {
-                                       /* Restrict to 'common' equipments */
-                                       if (!is_rare(o_ptr)) ADD_FLG(FLG_COMMON);
-                               }
+                               /* Restrict to 'common' equipments */
+                               if (!object_is_rare(o_ptr)) ADD_FLG(FLG_COMMON);
                        }
 
                        ADD_FLG(FLG_EGO);
                }
 
                /* Artifact */
-               else if (o_ptr->name1 || o_ptr->art_name)
+               else if (object_is_artifact(o_ptr))
                        ADD_FLG(FLG_ARTIFACT);
 
                /* Non-ego, non-artifact */
                else
                {
                        /* Wearable nameless object */
-                       if ((TV_EQUIP_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_EQUIP_END))
+                       if (object_is_equipment(o_ptr))
                                ADD_FLG(FLG_NAMELESS);
 
                        bol_mark = TRUE;
@@ -695,17 +565,17 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
 
        }
 
-
-       switch(o_ptr->tval)
+       /* Melee weapon with boosted dice */
+       if (object_is_melee_weapon(o_ptr))
        {
-               object_kind *k_ptr; 
-       case TV_HAFTED: case TV_POLEARM: case TV_SWORD: case TV_DIGGING:
-               k_ptr = &k_info[o_ptr->k_idx];
+               object_kind *k_ptr = &k_info[o_ptr->k_idx];
+
                if ((o_ptr->dd != k_ptr->dd) || (o_ptr->ds != k_ptr->ds))
                        ADD_FLG(FLG_BOOSTED);
        }
 
-       if (o_ptr->tval == TV_CORPSE && object_is_shoukinkubi(o_ptr))
+       /* Wanted monster's corpse */
+       if (object_is_shoukinkubi(o_ptr))
        {
                REM_FLG(FLG_WORTHLESS);
                ADD_FLG(FLG_WANTED);
@@ -754,8 +624,7 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        if (o_ptr->tval >= TV_LIFE_BOOK && 3 == o_ptr->sval)
                ADD_FLG(FLG_FOURTH);
 
-       if (o_ptr->tval == TV_SHOT || o_ptr->tval == TV_BOLT
-                || o_ptr->tval == TV_ARROW)
+       if (object_is_ammo(o_ptr))
                ADD_FLG(FLG_MISSILES);
        else if (o_ptr->tval == TV_SCROLL || o_ptr->tval == TV_STAFF
                 || o_ptr->tval == TV_WAND || o_ptr->tval == TV_ROD)
@@ -797,7 +666,7 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        {
                char o_name[MAX_NLEN];
 
-               object_desc(o_name, o_ptr, FALSE, 0);
+               object_desc(o_name, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NO_PLURAL | OD_NAME_ONLY));
 
                /*
                 * If necessary, add a '^' which indicates the
@@ -821,6 +690,8 @@ static void autopick_free_entry(autopick_type *entry)
 {
        string_free(entry->name);
        string_free(entry->insc);
+       entry->name = NULL;
+       entry->insc = NULL;
 }
 
 
@@ -862,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)
        {
@@ -874,7 +741,7 @@ static cptr pickpref_filename(int filename_mode)
                return format("%s.prf", namebase);
 
        case PT_WITH_PNAME:
-               return format("%s-%s.prf", namebase, player_name);
+               return format("%s-%s.prf", namebase, player_base);
 
        default:
                return NULL;
@@ -902,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 */
@@ -921,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."));
        }
 }
 
@@ -959,10 +814,10 @@ static void add_autopick_list(autopick_type *entry)
                C_MAKE(autopick_list, max_max_autopick, autopick_type);
 
                /* Copy from old list to new list */
-               C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type);
+               (void)C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type);
 
                /* Kill old list */
-               C_FREE(old_autopick_list, old_max_max_autopick, autopick_type);
+               C_KILL(old_autopick_list, old_max_max_autopick, autopick_type);
        }
 
        /* Add one line */
@@ -990,7 +845,7 @@ errr process_autopick_file_command(char *buf)
                        continue;
                }
 #endif
-               if (isspace(buf[i]) && buf[i] != ' ')
+               if (iswspace(buf[i]) && buf[i] != ' ')
                        break;
        }
        buf[i] = 0;
@@ -1003,7 +858,11 @@ errr process_autopick_file_command(char *buf)
                   && entry->flag[0] == autopick_list[i].flag[0]
                   && entry->flag[1] == autopick_list[i].flag[1]
                   && entry->dice == autopick_list[i].dice
-                  && entry->bonus == autopick_list[i].bonus) return 0;
+                  && entry->bonus == autopick_list[i].bonus)
+               {
+                       autopick_free_entry(entry);
+                       return 0;
+               }
 
        add_autopick_list(entry);
        return 0;
@@ -1060,7 +919,9 @@ cptr autopick_line_from_entry(autopick_type *entry)
        if (IS_FLG(FLG_UNIQUE)) ADD_KEY(KEY_UNIQUE);
        if (IS_FLG(FLG_HUMAN)) ADD_KEY(KEY_HUMAN);
        if (IS_FLG(FLG_WORTHLESS)) ADD_KEY(KEY_WORTHLESS);
+       if (IS_FLG(FLG_GOOD)) ADD_KEY(KEY_GOOD);
        if (IS_FLG(FLG_NAMELESS)) ADD_KEY(KEY_NAMELESS);
+       if (IS_FLG(FLG_AVERAGE)) ADD_KEY(KEY_AVERAGE);
        if (IS_FLG(FLG_RARE)) ADD_KEY(KEY_RARE);
        if (IS_FLG(FLG_COMMON)) ADD_KEY(KEY_COMMON);
        if (IS_FLG(FLG_EGO)) ADD_KEY(KEY_EGO);
@@ -1156,39 +1017,39 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        cptr ptr = entry->name;
 
        /*** Unaware items ***/
-       if (IS_FLG(FLG_UNAWARE) && object_aware_p(o_ptr))
+       if (IS_FLG(FLG_UNAWARE) && object_is_aware(o_ptr))
                return FALSE;
 
        /*** Unidentified ***/
        if (IS_FLG(FLG_UNIDENTIFIED)
-           && (object_known_p(o_ptr) || (o_ptr->ident & IDENT_SENSE)))
+           && (object_is_known(o_ptr) || (o_ptr->ident & IDENT_SENSE)))
                return FALSE;
 
        /*** Identified ***/
-       if (IS_FLG(FLG_IDENTIFIED) && !object_known_p(o_ptr))
+       if (IS_FLG(FLG_IDENTIFIED) && !object_is_known(o_ptr))
                return FALSE;
 
        /*** *Identified* ***/
        if (IS_FLG(FLG_STAR_IDENTIFIED) &&
-           (!object_known_p(o_ptr) || !(o_ptr->ident & IDENT_MENTAL)))
+           (!object_is_known(o_ptr) || !(o_ptr->ident & IDENT_MENTAL)))
                return FALSE;
 
        /*** Dice boosted (weapon of slaying) ***/
        if (IS_FLG(FLG_BOOSTED))
        {
                object_kind *k_ptr = &k_info[o_ptr->k_idx];
-                       
-               switch( o_ptr->tval )
+
+               /* Require melee weapon */
+               if (!object_is_melee_weapon(o_ptr))
+                       return FALSE;
+
+               /* Require boosted dice */
+               if ((o_ptr->dd == k_ptr->dd) && (o_ptr->ds == k_ptr->ds))
+                       return FALSE;
+               
+               /* In Vault Quest, Dice must be hide.*/
+               if(!object_is_known(o_ptr) && object_is_quest_target(o_ptr))
                {
-               case TV_HAFTED:
-               case TV_POLEARM:
-               case TV_SWORD:
-               case TV_DIGGING:
-                       if ((o_ptr->dd != k_ptr->dd) || (o_ptr->ds != k_ptr->ds))
-                               break;
-                       else
-                               return FALSE;
-               default:
                        return FALSE;
                }
        }
@@ -1203,7 +1064,7 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        /*** Weapons whic dd*ds is more than nn ***/
        if (IS_FLG(FLG_MORE_BONUS))
        {
-               if (!object_known_p(o_ptr)) return FALSE;
+               if (!object_is_known(o_ptr)) return FALSE;
 
                if (o_ptr->pval)
                {
@@ -1226,7 +1087,7 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        /*** Artifact object ***/
        if (IS_FLG(FLG_ARTIFACT))
        {
-               if (!object_known_p(o_ptr) || (!o_ptr->name1 && !o_ptr->art_name))
+               if (!object_is_known(o_ptr) || !object_is_artifact(o_ptr))
                        return FALSE;
        }
 
@@ -1234,25 +1095,64 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        if (IS_FLG(FLG_EGO))
        {
                /* Need to be an ego item */
-               if (!o_ptr->name2) return FALSE;
+               if (!object_is_ego(o_ptr)) return FALSE;
 
                /* Need to be known to be an ego */
-               if (!object_known_p(o_ptr) &&
+               if (!object_is_known(o_ptr) &&
                    !((o_ptr->ident & IDENT_SENSE) && o_ptr->feeling == FEEL_EXCELLENT))
                        return FALSE;
        }
 
+       /*** Good ***/
+       if (IS_FLG(FLG_GOOD))
+       {
+               if (!object_is_equipment(o_ptr)) return FALSE;
+
+               /* Identified */
+               if (object_is_known(o_ptr))
+               {
+                       /* Artifacts and Ego objects are not okay */
+                       if (!object_is_nameless(o_ptr))
+                               return FALSE;
+
+                       /* Average are not okay */
+                       if (o_ptr->to_a <= 0 && (o_ptr->to_h + o_ptr->to_d) <= 0)
+                               return FALSE;
+               }
+
+               /* Pseudo-identified */
+               else if (o_ptr->ident & IDENT_SENSE)
+               {
+                       switch (o_ptr->feeling)
+                       {
+                       case FEEL_GOOD:
+                               /* It's good */
+                               break;
+
+                       default:
+                               /* It's not good */
+                               return FALSE;
+                       }
+               }
+
+               /* Unidentified */
+               else
+               {
+                       /* Not known to be good */
+                       return FALSE;
+               }
+       }
+
        /*** Nameless ***/
        if (IS_FLG(FLG_NAMELESS))
        {
-               if (!(TV_EQUIP_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_EQUIP_END))
-                       return FALSE;
+               if (!object_is_equipment(o_ptr)) return FALSE;
 
                /* Identified */
-               if (object_known_p(o_ptr))
+               if (object_is_known(o_ptr))
                {
                        /* Artifacts and Ego objects are not okay */
-                       if (o_ptr->name1 || o_ptr->art_name || o_ptr->name2)
+                       if (!object_is_nameless(o_ptr))
                                return FALSE;
                }
 
@@ -1282,17 +1182,60 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
                }
        }
 
-       /*** Rere equpiments ***/
-       if (IS_FLG(FLG_RARE) && !is_rare(o_ptr))
+       /*** Average ***/
+       if (IS_FLG(FLG_AVERAGE))
+       {
+               if (!object_is_equipment(o_ptr)) return FALSE;
+
+               /* Identified */
+               if (object_is_known(o_ptr))
+               {
+                       /* Artifacts and Ego objects are not okay */
+                       if (!object_is_nameless(o_ptr))
+                               return FALSE;
+
+                       /* Cursed or broken objects are not okay */
+                       if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
+                               return FALSE;
+
+                       /* Good are not okay */
+                       if (o_ptr->to_a > 0 || (o_ptr->to_h + o_ptr->to_d) > 0)
+                               return FALSE;
+               }
+
+               /* Pseudo-identified */
+               else if (o_ptr->ident & IDENT_SENSE)
+               {
+                       switch (o_ptr->feeling)
+                       {
+                       case FEEL_AVERAGE:
+                               /* It's average */
+                               break;
+
+                       default:
+                               /* It's not average */
+                               return FALSE;
+                       }
+               }
+
+               /* Unidentified */
+               else
+               {
+                       /* Not known to be average */
+                       return FALSE;
+               }
+       }
+
+       /*** Rere equipments ***/
+       if (IS_FLG(FLG_RARE) && !object_is_rare(o_ptr))
                return FALSE;
 
-       /*** Common equpiments ***/
-       if (IS_FLG(FLG_COMMON) && is_rare(o_ptr))
+       /*** Common equipments ***/
+       if (IS_FLG(FLG_COMMON) && object_is_rare(o_ptr))
                return FALSE;
 
        /*** Wanted monster's corpse/skeletons ***/
-       if (IS_FLG(FLG_WANTED) &&
-           (o_ptr->tval != TV_CORPSE || !object_is_shoukinkubi(o_ptr)))
+       if (IS_FLG(FLG_WANTED) && !object_is_shoukinkubi(o_ptr))
                return FALSE;
 
        /*** Unique monster's corpse/skeletons/statues ***/
@@ -1350,27 +1293,22 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        /*** Items ***/
        if (IS_FLG(FLG_WEAPONS))
        {
-               if (!(TV_WEAPON_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_WEAPON_END))
+               if (!object_is_weapon(o_ptr))
                        return FALSE;
        }
        else if (IS_FLG(FLG_FAVORITE_WEAPONS))
        {
-               if (!is_favorite(o_ptr))
+               if (!object_is_favorite(o_ptr))
                        return FALSE;
        }
        else if (IS_FLG(FLG_ARMORS))
        {
-               if (!(TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END))
+               if (!object_is_armour(o_ptr))
                        return FALSE;
        }
        else if (IS_FLG(FLG_MISSILES))
        {
-               switch(o_ptr->tval)
-               {
-               case TV_SHOT: case TV_BOLT: case TV_ARROW:
-                       break;
-               default: return FALSE;
-               }
+               if (!object_is_ammo(o_ptr)) return FALSE;
        }
        else if (IS_FLG(FLG_DEVICES))
        {
@@ -1503,7 +1441,7 @@ int is_autopick(object_type *o_ptr)
        if (o_ptr->tval == TV_GOLD) return -1;
 
        /* Prepare object name string first */
-       object_desc(o_name, o_ptr, FALSE, 3);
+       object_desc(o_name, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NO_PLURAL));
 
        /* Convert the string to lower case */
        str_tolower(o_name);
@@ -1550,22 +1488,21 @@ static bool is_opt_confirm_destroy(object_type *o_ptr)
        /* Known to be worthless? */
        if (leave_worth)
                if (object_value(o_ptr) > 0) return FALSE;
-       
+
        if (leave_equip)
-               if ((o_ptr->tval >= TV_MISSILE_BEGIN) && (o_ptr->tval <= TV_ARMOR_END)) return FALSE;
-       
+               if (object_is_weapon_armour_ammo(o_ptr)) return FALSE;
+
        if (leave_chest)
                if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
-       
+
        if (leave_wanted)
        {
-               if (o_ptr->tval == TV_CORPSE
-                   && object_is_shoukinkubi(o_ptr)) return FALSE;
+               if (object_is_shoukinkubi(o_ptr)) return FALSE;
        }
-       
+
        if (leave_corpse)
                if (o_ptr->tval == TV_CORPSE) return FALSE;
-       
+
        if (leave_junk)
                if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
 
@@ -1588,20 +1525,20 @@ static bool is_opt_confirm_destroy(object_type *o_ptr)
                else if (p_ptr->pclass == CLASS_NINJA)
                {
                        if (o_ptr->tval == TV_LITE &&
-                           o_ptr->name2 == EGO_LITE_DARKNESS)
+                           o_ptr->name2 == EGO_LITE_DARKNESS && object_is_known(o_ptr))
                                return FALSE;
                }
                else if (p_ptr->pclass == CLASS_BEASTMASTER ||
                         p_ptr->pclass == CLASS_CAVALRY)
                {
                        if (o_ptr->tval == TV_WAND &&
-                           o_ptr->sval == SV_WAND_HEAL_MONSTER)
+                           o_ptr->sval == SV_WAND_HEAL_MONSTER && object_is_aware(o_ptr))
                                return FALSE;
                }
        }
-       
+
        if (o_ptr->tval == TV_GOLD) return FALSE;
-       
+
        return TRUE;
 }
 
@@ -1640,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))
@@ -1648,21 +1585,15 @@ static void auto_destroy_item(object_type *o_ptr, int autopick_idx)
                char o_name[MAX_NLEN];
 
                /* Describe the object (with {terrible/special}) */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               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;
        }
 
        /* Record name of destroyed item */
-       COPY(&autopick_last_destroyed_object, o_ptr, object_type);
+       (void)COPY(&autopick_last_destroyed_object, o_ptr, object_type);
 
        /* Destroy Later */
        o_ptr->marked |= OM_AUTODESTROY;
@@ -1675,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;
 
@@ -1685,12 +1616,12 @@ static void autopick_delayed_alter_aux(int item)
        /* Get the item (on the floor) */
        else o_ptr = &o_list[0 - item];
 
-       if (o_ptr->k_idx && o_ptr->marked & OM_AUTODESTROY)
+       if (o_ptr->k_idx && (o_ptr->marked & OM_AUTODESTROY))
        {
                char o_name[MAX_NLEN];
 
                /* Describe the object (with {terrible/special}) */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Eliminate the item (from the pack) */
                if (item >= 0)
@@ -1705,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);
        }
 }
 
@@ -1720,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
@@ -1730,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;
        }
@@ -1746,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;
@@ -1774,7 +1700,7 @@ 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)
@@ -1795,21 +1721,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, TRUE, 3);
+                               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;
 
@@ -1826,14 +1746,9 @@ void autopick_pickup_items(cave_type *c_ptr)
                                        continue;
                                }
 
-                               /* Describe the object */
-                               object_desc(o_name, o_ptr, TRUE, 3);
+                               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))
                                {
@@ -1898,12 +1813,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;
        }
@@ -1945,13 +1855,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))
@@ -1959,11 +1865,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."));
                }
        }
 
@@ -2008,44 +1911,27 @@ 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;
        }
 
        /* Known to be an artifact? */
-       if ((object_known_p(o_ptr) &&
-            (artifact_p(o_ptr) || o_ptr->art_name)) ||
+       if ((object_is_known(o_ptr) && object_is_artifact(o_ptr)) ||
            ((o_ptr->ident & IDENT_SENSE) &&
             (o_ptr->feeling == FEEL_TERRIBLE || o_ptr->feeling == FEEL_SPECIAL)))
        {
                char o_name[MAX_NLEN];
 
                /* Describe the object (with {terrible/special}) */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               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;
        }
 
@@ -2096,11 +1982,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 */
@@ -2112,13 +1994,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;
@@ -2228,213 +2107,227 @@ static void describe_autopick(char *buff, autopick_type *entry)
        cptr before_str[100], body_str;
        int before_n = 0;
 
-       body_str = "¥¢¥¤¥Æ¥à";
+       body_str = "アイテム";
 
        /*** Collecting items ***/
        /*** Which can be absorbed into a slot as a bundle ***/
        if (IS_FLG(FLG_COLLECTING))
-               before_str[before_n++] = "¼ý½¸Ãæ¤Ç´û¤Ë»ý¤Ã¤Æ¤¤¤ë¥¹¥í¥Ã¥È¤Ë¤Þ¤È¤á¤é¤ì¤ë";
+               before_str[before_n++] = "収集中で既に持っているスロットにまとめられる";
        
        /*** Unaware items ***/
        if (IS_FLG(FLG_UNAWARE))
-               before_str[before_n++] = "̤´ÕÄê¤Ç¤½¤Î¸ú²Ì¤âȽÌÀ¤·¤Æ¤¤¤Ê¤¤";
+               before_str[before_n++] = "未鑑定でその効果も判明していない";
 
        /*** Unidentified ***/
        if (IS_FLG(FLG_UNIDENTIFIED))
-               before_str[before_n++] = "̤´ÕÄê¤Î";
+               before_str[before_n++] = "未鑑定の";
 
        /*** Identified ***/
        if (IS_FLG(FLG_IDENTIFIED))
-               before_str[before_n++] = "´ÕÄêºÑ¤ß¤Î";
+               before_str[before_n++] = "鑑定済みの";
 
        /*** *Identified* ***/
        if (IS_FLG(FLG_STAR_IDENTIFIED))
-               before_str[before_n++] = "´°Á´¤Ë´ÕÄêºÑ¤ß¤Î";
+               before_str[before_n++] = "完全に鑑定済みの";
 
        /*** Dice boosted (weapon of slaying) ***/
        if (IS_FLG(FLG_BOOSTED))
        {
-               before_str[before_n++] = "¥À¥á¡¼¥¸¥À¥¤¥¹¤¬Ä̾ï¤è¤êÂ礭¤¤";
-               body_str = "Éð´ï";
+               before_str[before_n++] = "ダメージダイスが通常より大きい";
+               body_str = "武器";
        }
 
        /*** Weapons whose dd*ds is more than nn ***/
        if (IS_FLG(FLG_MORE_DICE))
        {
                static char more_than_desc_str[] = "___";
-               before_str[before_n++] = "¥À¥á¡¼¥¸¥À¥¤¥¹¤ÎºÇÂçÃͤ¬";
-               body_str = "Éð´ï";
+               before_str[before_n++] = "ダメージダイスの最大値が";
+               body_str = "武器";
                        
                sprintf(more_than_desc_str,"%d", entry->dice);
                before_str[before_n++] = more_than_desc_str;
-               before_str[before_n++] = "°Ê¾å¤Î";
+               before_str[before_n++] = "以上の";
        }
 
        /*** Items whose magical bonus is more than nn ***/
        if (IS_FLG(FLG_MORE_BONUS))
        {
                static char more_bonus_desc_str[] = "___";
-               before_str[before_n++] = "½¤ÀµÃͤ¬(+";
+               before_str[before_n++] = "修正値が(+";
                        
                sprintf(more_bonus_desc_str,"%d", entry->bonus);
                before_str[before_n++] = more_bonus_desc_str;
-               before_str[before_n++] = ")°Ê¾å¤Î";
+               before_str[before_n++] = ")以上の";
        }
 
        /*** Worthless items ***/
        if (IS_FLG(FLG_WORTHLESS))
-               before_str[before_n++] = "Ź¤Ç̵²ÁÃͤÈȽÄꤵ¤ì¤ë";
+               before_str[before_n++] = "店で無価値と判定される";
 
        /*** Artifact ***/
        if (IS_FLG(FLG_ARTIFACT))
        {
-               before_str[before_n++] = "¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "アーティファクトの";
+               body_str = "装備";
        }
 
        /*** Ego ***/
        if (IS_FLG(FLG_EGO))
        {
-               before_str[before_n++] = "¥¨¥´¥¢¥¤¥Æ¥à¤Î";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "エゴアイテムの";
+               body_str = "装備";
+       }
+
+       /*** Good ***/
+       if (IS_FLG(FLG_GOOD))
+       {
+               before_str[before_n++] = "上質の";
+               body_str = "装備";
        }
 
        /*** Nameless ***/
        if (IS_FLG(FLG_NAMELESS))
        {
-               before_str[before_n++] = "¥¨¥´¤Ç¤â¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ç¤â¤Ê¤¤";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "エゴでもアーティファクトでもない";
+               body_str = "装備";
+       }
+
+       /*** Average ***/
+       if (IS_FLG(FLG_AVERAGE))
+       {
+               before_str[before_n++] = "並の";
+               body_str = "装備";
        }
 
-       /*** Rare equpiments ***/
+       /*** Rare equipments ***/
        if (IS_FLG(FLG_RARE))
        {
-               before_str[before_n++] = "¥É¥é¥´¥óÁõÈ÷¤ä¥«¥ª¥¹¡¦¥Ö¥ì¡¼¥ÉÅù¤ò´Þ¤àÄÁ¤·¤¤";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "ドラゴン装備やカオス・ブレード等を含む珍しい";
+               body_str = "装備";
        }
 
-       /*** Common equpiments ***/
+       /*** Common equipments ***/
        if (IS_FLG(FLG_COMMON))
        {
-               before_str[before_n++] = "¤¢¤ê¤Õ¤ì¤¿(¥É¥é¥´¥óÁõÈ÷¤ä¥«¥ª¥¹¡¦¥Ö¥ì¡¼¥ÉÅù¤ÎÄÁ¤·¤¤Êª¤Ç¤Ï¤Ê¤¤)";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "ありふれた(ドラゴン装備やカオス・ブレード等の珍しい物ではない)";
+               body_str = "装備";
        }
 
        /*** Wanted monster's corpse/skeletons ***/
        if (IS_FLG(FLG_WANTED))
        {
-               before_str[before_n++] = "¥Ï¥ó¥¿¡¼»ö̳½ê¤Ç¾Þ¶â¼ó¤È¤µ¤ì¤Æ¤¤¤ë";
-               body_str = "»àÂΤä¹ü";
+               before_str[before_n++] = "ハンター事務所で賞金首とされている";
+               body_str = "死体や骨";
        }
 
        /*** Human corpse/skeletons (for Daemon magic) ***/
        if (IS_FLG(FLG_HUMAN))
        {
-               before_str[before_n++] = "°­ËâËâË¡¤Ç»È¤¦¤¿¤á¤Î¿Í´Ö¤ä¥Ò¥å¡¼¥Þ¥Î¥¤¥É¤Î";
-               body_str = "»àÂΤä¹ü";
+               before_str[before_n++] = "悪魔魔法で使うための人間やヒューマノイドの";
+               body_str = "死体や骨";
        }
 
        /*** Unique monster's corpse/skeletons/statues ***/
        if (IS_FLG(FLG_UNIQUE))
        {
-               before_str[before_n++] = "¥æ¥Ë¡¼¥¯¥â¥ó¥¹¥¿¡¼¤Î";
-               body_str = "»àÂΤä¹ü";
+               before_str[before_n++] = "ユニークモンスターの";
+               body_str = "死体や骨";
        }
 
        /*** Unreadable spellbooks ***/
        if (IS_FLG(FLG_UNREADABLE))
        {
-               before_str[before_n++] = "¤¢¤Ê¤¿¤¬Æɤá¤Ê¤¤Îΰè¤Î";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "あなたが読めない領域の";
+               body_str = "魔法書";
        }
 
        /*** First realm spellbooks ***/
        if (IS_FLG(FLG_REALM1))
        {
-               before_str[before_n++] = "Âè°ìÎΰè¤Î";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "第一領域の";
+               body_str = "魔法書";
        }
 
        /*** Second realm spellbooks ***/
        if (IS_FLG(FLG_REALM2))
        {
-               before_str[before_n++] = "ÂèÆóÎΰè¤Î";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "第二領域の";
+               body_str = "魔法書";
        }
 
        /*** First rank spellbooks ***/
        if (IS_FLG(FLG_FIRST))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î1ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の1冊目の";
+               body_str = "魔法書";
        }
 
        /*** Second rank spellbooks ***/
        if (IS_FLG(FLG_SECOND))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î2ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の2冊目の";
+               body_str = "魔法書";
        }
 
        /*** Third rank spellbooks ***/
        if (IS_FLG(FLG_THIRD))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î3ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の3冊目の";
+               body_str = "魔法書";
        }
 
        /*** Fourth rank spellbooks ***/
        if (IS_FLG(FLG_FOURTH))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î4ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の4冊目の";
+               body_str = "魔法書";
        }
 
        /*** Items ***/
        if (IS_FLG(FLG_ITEMS))
                ; /* Nothing to do */
        else if (IS_FLG(FLG_WEAPONS))
-               body_str = "Éð´ï";
+               body_str = "武器";
        else if (IS_FLG(FLG_FAVORITE_WEAPONS))
-               body_str = "ÆÀ°ÕÉð´ï";
+               body_str = "得意武器";
        else if (IS_FLG(FLG_ARMORS))
-               body_str = "Ëɶñ";
+               body_str = "防具";
        else if (IS_FLG(FLG_MISSILES))
-               body_str = "ÃƤäÌð¤ä¥¯¥í¥¹¥Ü¥¦¤ÎÌð";
+               body_str = "弾や矢やクロスボウの矢";
        else if (IS_FLG(FLG_DEVICES))
-               body_str = "´¬Êª¤äËâË¡ËÀ¤ä¾ó¤ä¥í¥Ã¥É";
+               body_str = "巻物や魔法棒や杖やロッド";
        else if (IS_FLG(FLG_LIGHTS))
-               body_str = "¸÷¸»ÍѤΥ¢¥¤¥Æ¥à";
+               body_str = "光源用のアイテム";
        else if (IS_FLG(FLG_JUNKS))
-               body_str = "Àޤ줿ËÀÅù¤Î¥¬¥é¥¯¥¿";
+               body_str = "æ\8a\98ã\82\8cã\81\9fæ£\92ç­\89ã\81®ã\82¬ã\83©ã\82¯ã\82¿";
        else if (IS_FLG(FLG_CORPSES))
-               body_str = "»àÂΤä¹ü";
+               body_str = "死体や骨";
        else if (IS_FLG(FLG_SPELLBOOKS))
-               body_str = "ËâË¡½ñ";
+               body_str = "魔法書";
        else if (IS_FLG(FLG_HAFTED))
-               body_str = "Æß´ï";
+               body_str = "鈍器";
        else if (IS_FLG(FLG_SHIELDS))
-               body_str = "½â";
+               body_str = "";
        else if (IS_FLG(FLG_BOWS))
-               body_str = "¥¹¥ê¥ó¥°¤äµÝ¤ä¥¯¥í¥¹¥Ü¥¦";
+               body_str = "ã\82¹ã\83ªã\83³ã\82°ã\82\84å¼\93ã\82\84ã\82¯ã\83­ã\82¹ã\83\9cã\82¦";
        else if (IS_FLG(FLG_RINGS))
-               body_str = "»ØÎØ";
+               body_str = "指輪";
        else if (IS_FLG(FLG_AMULETS))
-               body_str = "¥¢¥ß¥å¥ì¥Ã¥È";
+               body_str = "アミュレット";
        else if (IS_FLG(FLG_SUITS))
-               body_str = "³»";
+               body_str = "";
        else if (IS_FLG(FLG_CLOAKS))
-               body_str = "¥¯¥í¡¼¥¯";
+               body_str = "ã\82¯ã\83­ã\83¼ã\82¯";
        else if (IS_FLG(FLG_HELMS))
-               body_str = "¥Ø¥ë¥á¥Ã¥È¤ä´§";
+               body_str = "ヘルメットや冠";
        else if (IS_FLG(FLG_GLOVES))
-               body_str = "äƼê";
+               body_str = "籠手";
        else if (IS_FLG(FLG_BOOTS))
-               body_str = "¥Ö¡¼¥Ä";
+               body_str = "ブーツ";
 
        *buff = '\0';
        if (!before_n) 
-               strcat(buff, "Á´¤Æ¤Î");
+               strcat(buff, "全ての");
        else for (i = 0; i < before_n && before_str[i]; i++)
                strcat(buff, before_str[i]);
 
@@ -2448,52 +2341,52 @@ static void describe_autopick(char *buff, autopick_type *entry)
                        top = TRUE;
                }
 
-               strcat(buff, "¤Ç¡¢Ì¾Á°¤¬¡Ö");
+               strcat(buff, "で、名前が「");
                strncat(buff, str, 80);
                if (top)
-                       strcat(buff, "¡×¤Ç»Ï¤Þ¤ë¤â¤Î");
+                       strcat(buff, "」で始まるもの");
                else
-                       strcat(buff, "¡×¤ò´Þ¤à¤â¤Î");
+                       strcat(buff, "」を含むもの");
        }
 
        if (insc)
        {
-               strncat(buff, format("¤Ë¡Ö%s¡×", insc), 80);
+               strncat(buff, format("に「%s」", insc), 80);
 
                if (my_strstr(insc, "%%all"))
-                       strcat(buff, "(%%all¤ÏÁ´Ç½ÎϤòɽ¤¹±Ñ»ú¤Îµ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%%allは全能力を表す英字の記号で置換)");
                else if (my_strstr(insc, "%all"))
-                       strcat(buff, "(%all¤ÏÁ´Ç½ÎϤòɽ¤¹µ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%allは全能力を表す記号で置換)");
                else if (my_strstr(insc, "%%"))
-                       strcat(buff, "(%%¤ÏÄɲÃǽÎϤòɽ¤¹±Ñ»ú¤Îµ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%%は追加能力を表す英字の記号で置換)");
                else if (my_strstr(insc, "%"))
-                       strcat(buff, "(%¤ÏÄɲÃǽÎϤòɽ¤¹µ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%は追加能力を表す記号で置換)");
 
-               strcat(buff, "¤È¹ï¤ó¤Ç");
+               strcat(buff, "と刻んで");
        }
        else
-               strcat(buff, "¤ò");
+               strcat(buff, "");
 
        if (act & DONT_AUTOPICK)
-               strcat(buff, "ÊüÃÖ¤¹¤ë¡£");
+               strcat(buff, "放置する。");
        else if (act & DO_AUTODESTROY)
-               strcat(buff, "Ç˲õ¤¹¤ë¡£");
+               strcat(buff, "破壊する。");
        else if (act & DO_QUERY_AUTOPICK)
-               strcat(buff, "³Îǧ¤Î¸å¤Ë½¦¤¦¡£");
+               strcat(buff, "確認の後に拾う。");
        else
-               strcat(buff, "½¦¤¦¡£");
+               strcat(buff, "拾う。");
 
        if (act & DO_DISPLAY)
        {
                if (act & DONT_AUTOPICK)
-                       strcat(buff, "Á´ÂΥޥå×('M')¤Ç'N'¤ò²¡¤·¤¿¤È¤­¤Ëɽ¼¨¤¹¤ë¡£");
+                       strcat(buff, "全体マップ('M')で'N'を押したときに表示する。");
                else if (act & DO_AUTODESTROY)
-                       strcat(buff, "Á´ÂΥޥå×('M')¤Ç'K'¤ò²¡¤·¤¿¤È¤­¤Ëɽ¼¨¤¹¤ë¡£");
+                       strcat(buff, "全体マップ('M')で'K'を押したときに表示する。");
                else
-                       strcat(buff, "Á´ÂΥޥå×('M')¤Ç'M'¤ò²¡¤·¤¿¤È¤­¤Ëɽ¼¨¤¹¤ë¡£");
+                       strcat(buff, "全体マップ('M')で'M'を押したときに表示する。");
        }
        else
-               strcat(buff, "Á´ÂΥޥåפˤÏɽ¼¨¤·¤Ê¤¤¡£");
+               strcat(buff, "全体マップには表示しない。");
 
 #else /* JP */
 
@@ -2526,7 +2419,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
        if (IS_FLG(FLG_STAR_IDENTIFIED))
                before_str[before_n++] = "fully identified";
 
-       /*** Rare equpiments ***/
+       /*** Rare equipments ***/
        if (IS_FLG(FLG_RARE))
        {
                before_str[before_n++] = "very rare";
@@ -2534,7 +2427,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
                after_str[after_n++] = "such like Dragon armors, Blades of Chaos, etc.";
        }
 
-       /*** Common equpiments ***/
+       /*** Common equipments ***/
        if (IS_FLG(FLG_COMMON))
        {
                before_str[before_n++] = "relatively common";
@@ -2561,6 +2454,13 @@ static void describe_autopick(char *buff, autopick_type *entry)
                before_str[before_n++] = "ego";
        }
 
+       /*** Good ***/
+       if (IS_FLG(FLG_GOOD))
+       {
+               body_str = "equipment";
+               which_str[which_n++] = "have good quality";
+       }
+
        /*** Nameless ***/
        if (IS_FLG(FLG_NAMELESS))
        {
@@ -2568,6 +2468,13 @@ static void describe_autopick(char *buff, autopick_type *entry)
                which_str[which_n++] = "is neither ego-item nor artifact";
        }
 
+       /*** Average ***/
+       if (IS_FLG(FLG_AVERAGE))
+       {
+               body_str = "equipment";
+               which_str[which_n++] = "have average quality";
+       }
+
        /*** Dice boosted (weapon of slaying) ***/
        if (IS_FLG(FLG_BOOSTED))
        {
@@ -2868,18 +2775,11 @@ static cptr *read_text_lines(cptr filename)
  */
 static void prepare_default_pickpref(void)
 {
-       static char *messages[] = {
-#ifdef JP
-               "¤¢¤Ê¤¿¤Ï¡Ö¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿¡×¤ò½é¤á¤Æµ¯Æ°¤·¤Þ¤·¤¿¡£",
-               "¼«Æ°½¦¤¤¤Î¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤¬¤Þ¤À½ñ¤«¤ì¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢",
-               "´ðËÜŪ¤Ê¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤òlib/pref/picktype.prf¤«¤é¥³¥Ô¡¼¤·¤Þ¤¹¡£",
-               NULL
-#else
-               "You have activated the Auto-Picker Editor for the first time.",
-               "Since no user preference file for autopick is not yet created,",
-               "the default setting is loaded from lib/pref/pickpref.prf .",
+       const cptr messages[] = {
+               _("あなたは「自動拾いエディタ」を初めて起動しました。", "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];
@@ -3010,14 +2910,14 @@ static void free_text_lines(cptr *lines_list)
                string_free(lines_list[lines]);
 
        /* free list of pointers */
-       C_FREE((char **)lines_list, MAX_LINES, char *);
+       C_KILL(lines_list, MAX_LINES, cptr);
 }
 
 
 /*
  * 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;
@@ -3073,10 +2973,10 @@ static void toggle_keyword(text_body_type *tb, int flg)
                }
                
                /* You can use only one flag in artifact/ego/nameless */
-               else if (FLG_ARTIFACT <= flg && flg <= FLG_NAMELESS)
+               else if (FLG_ARTIFACT <= flg && flg <= FLG_AVERAGE)
                {
                        int i;
-                       for (i = FLG_ARTIFACT; i <= FLG_NAMELESS; i++)
+                       for (i = FLG_ARTIFACT; i <= FLG_AVERAGE; i++)
                                REM_FLG(i);
                }
                
@@ -3189,7 +3089,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;
 
@@ -3264,6 +3164,36 @@ static void check_expression_line(text_body_type *tb, int y)
 
 
 /*
+ * Add an empty line at the last of the file
+ */
+static bool add_empty_line(text_body_type *tb)
+{
+       int k;
+
+       for (k = 0; tb->lines_list[k]; k++)
+               /* count number of lines */ ;
+
+       /* Too many lines! */
+       if (k >= MAX_LINES - 2) return FALSE;
+
+       /* The last line is already empty */
+       if (!tb->lines_list[k-1][0]) return FALSE;
+
+       /* Create new empty line */
+       tb->lines_list[k] = string_make("");
+
+       /* Expressions need re-evaluation */
+       tb->dirty_flags |= DIRTY_EXPRESSION;
+
+       /* Text is changed */
+       tb->changed = TRUE;
+
+       /* A line is added */
+       return TRUE;
+}
+
+
+/*
  * Insert return code and split the line
  */
 static bool insert_return_code(text_body_type *tb)
@@ -3313,7 +3243,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;
 
@@ -3333,10 +3263,9 @@ static bool entry_from_choosed_object(autopick_type *entry)
        object_type *o_ptr;
        cptr q, s;
 
-       /* Get an item */
 #ifdef JP
-       q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÅÐÏ¿¤·¤Þ¤¹¤«? ";
-       s = "¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
+       q = "どのアイテムを登録しますか? ";
+       s = "アイテムを持っていない。";
 #else
        q = "Enter which item? ";
        s = "You have nothing to enter.";
@@ -3358,10 +3287,9 @@ 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 = "¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
+       q = "どのアイテムを検索しますか? ";
+       s = "アイテムを持っていない。";
 #else
        q = "Enter which item? ";
        s = "You have nothing to enter.";
@@ -3372,7 +3300,7 @@ static byte get_object_for_search(object_type **o_handle, cptr *search_strp)
        *o_handle = o_ptr;
 
        string_free(*search_strp);
-       object_desc(buf, *o_handle, FALSE, 3);
+       object_desc(buf, *o_handle, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NO_PLURAL));
        *search_strp = string_make(format("<%s>", buf));
        return 1;
 }
@@ -3390,7 +3318,7 @@ static byte get_destroyed_object_for_search(object_type **o_handle, cptr *search
        *o_handle = &autopick_last_destroyed_object;
 
        string_free(*search_strp);
-       object_desc(buf, *o_handle, FALSE, 3);
+       object_desc(buf, *o_handle, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NO_PLURAL));
        *search_strp = string_make(format("<%s>", buf));
        return 1;
 }
@@ -3412,11 +3340,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 */
@@ -3519,7 +3443,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'):
@@ -3704,13 +3627,15 @@ static void search_for_object(text_body_type *tb, object_type *o_ptr, bool forwa
        int i = tb->cy;
 
        /* Prepare object name string first */
-       object_desc(o_name, o_ptr, FALSE, 3);
+       object_desc(o_name, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NO_PLURAL));
 
        /* Convert the string to lower case */
        str_tolower(o_name);
 
        while (TRUE)
        {
+               bool match;
+
                /* End of list? */
                if (forward)
                {
@@ -3725,8 +3650,9 @@ static void search_for_object(text_body_type *tb, object_type *o_ptr, bool forwa
                if (!autopick_new_entry(entry, tb->lines_list[i], FALSE)) continue;
 
                /* Does this line match to the object? */
-               if (!is_autopick_aux(o_ptr, entry, o_name)) continue;
-
+               match = is_autopick_aux(o_ptr, entry, o_name);
+               autopick_free_entry(entry);
+               if (!match)     continue;
 
                /* Found a line but it's inactive */
                if (tb->states[i] & LSTAT_BYPASS)
@@ -3859,11 +3785,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 
@@ -3907,197 +3833,183 @@ static void search_for_string(text_body_type *tb, cptr search_str, bool forward)
 #define EC_OK_WORTHLESS               46
 #define EC_OK_ARTIFACT        47
 #define EC_OK_EGO             48
-#define EC_OK_NAMELESS        49
-#define EC_OK_RARE            50       
-#define EC_OK_COMMON          51
-#define EC_OK_WANTED          52
-#define EC_OK_UNIQUE          53
-#define EC_OK_HUMAN           54
-#define EC_OK_UNREADABLE       55
-#define EC_OK_REALM1          56
-#define EC_OK_REALM2          57
-#define EC_OK_FIRST           58
-#define EC_OK_SECOND          59
-#define EC_OK_THIRD           60
-#define EC_OK_FOURTH          61
-#define EC_KK_WEAPONS         62
-#define EC_KK_FAVORITE_WEAPONS 63
-#define EC_KK_ARMORS          64
-#define EC_KK_MISSILES        65
-#define EC_KK_DEVICES         66
-#define EC_KK_LIGHTS          67
-#define EC_KK_JUNKS           68
-#define EC_KK_CORPSES         69
-#define EC_KK_SPELLBOOKS       70
-#define EC_KK_SHIELDS         71
-#define EC_KK_BOWS            72
-#define EC_KK_RINGS           73
-#define EC_KK_AMULETS         74
-#define EC_KK_SUITS           75
-#define EC_KK_CLOAKS          76
-#define EC_KK_HELMS           77
-#define EC_KK_GLOVES          78
-#define EC_KK_BOOTS           79
+#define EC_OK_GOOD            49
+#define EC_OK_NAMELESS        50
+#define EC_OK_AVERAGE         51
+#define EC_OK_RARE            52       
+#define EC_OK_COMMON          53
+#define EC_OK_WANTED          54
+#define EC_OK_UNIQUE          55
+#define EC_OK_HUMAN           56
+#define EC_OK_UNREADABLE       57
+#define EC_OK_REALM1          58
+#define EC_OK_REALM2          59
+#define EC_OK_FIRST           60
+#define EC_OK_SECOND          61
+#define EC_OK_THIRD           62
+#define EC_OK_FOURTH          63
+#define EC_KK_WEAPONS         64
+#define EC_KK_FAVORITE_WEAPONS 65
+#define EC_KK_ARMORS          66
+#define EC_KK_MISSILES        67
+#define EC_KK_DEVICES         68
+#define EC_KK_LIGHTS          69
+#define EC_KK_JUNKS           70
+#define EC_KK_CORPSES         71
+#define EC_KK_SPELLBOOKS       72
+#define EC_KK_SHIELDS         73
+#define EC_KK_BOWS            74
+#define EC_KK_RINGS           75
+#define EC_KK_AMULETS         76
+#define EC_KK_SUITS           77
+#define EC_KK_CLOAKS          78
+#define EC_KK_HELMS           79
+#define EC_KK_GLOVES          80
+#define EC_KK_BOOTS           81
 
 
 /* Manu names */
 #ifdef JP
 
-#define MN_QUIT "¥»¡¼¥Ö̵¤·¤Ç½ªÎ»" 
-#define MN_SAVEQUIT "¥»¡¼¥Ö¤·¤Æ½ªÎ»" 
-#define MN_REVERT "Á´¤Æ¤ÎÊѹ¹¤òÇË´þ" 
-#define MN_HELP "¥Ø¥ë¥×" 
-
-#define MN_MOVE "¥«¡¼¥½¥ë°ÜÆ°" 
-#define MN_LEFT   "º¸          (¢«Ìð°õ¥­¡¼)" 
-#define MN_DOWN   "²¼          (¢­Ìð°õ¥­¡¼)" 
-#define MN_UP     "¾å          (¢¬Ìð°õ¥­¡¼)" 
-#define MN_RIGHT  "±¦          (¢ªÌð°õ¥­¡¼)" 
-#define MN_BOL    "¹Ô¤ÎÀèƬ" 
-#define MN_EOL    "¹Ô¤Î½ªÃ¼" 
-#define MN_PGUP   "¾å¤Î¥Ú¡¼¥¸  (PageUp¥­¡¼)" 
-#define MN_PGDOWN "²¼¤Î¥Ú¡¼¥¸  (PageDown¥­¡¼)" 
-#define MN_TOP    "1¹ÔÌܤذÜÆ° (Home¥­¡¼)" 
-#define MN_BOTTOM "ºÇ²¼¹Ô¤Ø°ÜÆ°(End¥­¡¼)" 
-
-#define MN_EDIT "ÊÔ½¸" 
-#define MN_CUT "¥«¥Ã¥È" 
-#define MN_COPY "¥³¥Ô¡¼" 
-#define MN_PASTE "¥Ú¡¼¥¹¥È" 
-#define MN_BLOCK "ÁªÂòÈϰϤλØÄê" 
-#define MN_KILL_LINE "¹Ô¤Î»Ä¤ê¤òºï½ü" 
-#define MN_DELETE_CHAR "1ʸ»úºï½ü" 
-#define MN_BACKSPACE "¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹" 
-#define MN_RETURN "²þ¹Ô" 
-#define MN_RETURN "²þ¹Ô" 
-
-#define MN_SEARCH "¸¡º÷" 
-#define MN_SEARCH_STR "ʸ»úÎó¤Ç¸¡º÷" 
-#define MN_SEARCH_FORW "Á°Êý¤ØºÆ¸¡º÷" 
-#define MN_SEARCH_BACK "¸åÊý¤ØºÆ¸¡º÷" 
-#define MN_SEARCH_OBJ "¥¢¥¤¥Æ¥à¤òÁªÂò¤·¤Æ¸¡º÷" 
-#define MN_SEARCH_DESTROYED "¼«Æ°Ç˲õ¤µ¤ì¤¿¥¢¥¤¥Æ¥à¤Ç¸¡º÷" 
-
-#define MN_INSERT "¿§¡¹ÁÞÆþ" 
-#define MN_INSERT_OBJECT "ÁªÂò¤·¤¿¥¢¥¤¥Æ¥à¤Î̾Á°¤òÁÞÆþ" 
-#define MN_INSERT_DESTROYED "¼«Æ°Ç˲õ¤µ¤ì¤¿¥¢¥¤¥Æ¥à¤Î̾Á°¤òÁÞÆþ" 
-#define MN_INSERT_BLOCK "¾ò·ïʬ´ô¥Ö¥í¥Ã¥¯¤ÎÎã¤òÁÞÆþ" 
-#define MN_INSERT_MACRO "¥Þ¥¯¥íÄêµÁ¤òÁÞÆþ" 
-#define MN_INSERT_KEYMAP "¥­¡¼¥Þ¥Ã¥×ÄêµÁ¤òÁÞÆþ" 
-
-#ifdef MAC_MPW
-#define MN_COMMAND_LETTER "½¦¤¤/Ç˲õ/\x95\xfaÃÖ¤ÎÁªÂò" 
-#else
-#define MN_COMMAND_LETTER "½¦¤¤/Ç˲õ/ÊüÃÖ¤ÎÁªÂò" 
-#endif
-#define MN_CL_AUTOPICK "¡Ö ¡× (¼«Æ°½¦¤¤)" 
-#define MN_CL_DESTROY "¡Ö!¡× (¼«Æ°Ç˲õ)" 
-#ifdef MAC_MPW
-#define MN_CL_LEAVE "¡Ö~¡× (\x95\xfaÃÖ)" 
-#else
-#define MN_CL_LEAVE "¡Ö~¡× (ÊüÃÖ)" 
-#endif
-#define MN_CL_QUERY "¡Ö;¡× (³Îǧ¤·¤Æ½¦¤¦)" 
-#define MN_CL_NO_DISP "¡Ö(¡× (¥Þ¥Ã¥×¥³¥Þ¥ó¥É¤Çɽ¼¨¤·¤Ê¤¤)" 
-
-#define MN_ADJECTIVE_GEN "·ÁÍÆ»ì(°ìÈÌ)¤ÎÁªÂò" 
-
-#define MN_ADJECTIVE_SPECIAL "·ÁÍÆ»ì(Æüì)¤ÎÁªÂò" 
-#define MN_BOOSTED "¥À¥¤¥¹Ìܤΰ㤦 (Éð´ï)" 
-#define MN_MORE_DICE "¥À¥¤¥¹ÌÜ # °Ê¾å¤Î (Éð´ï)" 
-#define MN_MORE_BONUS "½¤ÀµÃÍ # °Ê¾å¤Î (»ØÎØÅù)" 
-#define MN_ARTIFACT "¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È (ÁõÈ÷)" 
-#define MN_EGO "¥¨¥´ (ÁõÈ÷)" 
-#define MN_NAMELESS "̵ÌäΠ(ÁõÈ÷)" 
-#define MN_RARE "¥ì¥¢¤Ê (ÁõÈ÷)" 
-#define MN_COMMON "¤¢¤ê¤Õ¤ì¤¿ (ÁõÈ÷)" 
-#define MN_WANTED "¾Þ¶â¼ó¤Î (»àÂÎ)" 
-#define MN_UNIQUE "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î (»àÂÎ)" 
-#define MN_HUMAN "¿Í´Ö¤Î (»àÂÎ)" 
-#define MN_UNREADABLE "Æɤá¤Ê¤¤ (ËâË¡½ñ)" 
-#define MN_REALM1 "Âè°ìÎΰè¤Î (ËâË¡½ñ)" 
-#define MN_REALM2 "ÂèÆóÎΰè¤Î (ËâË¡½ñ)" 
-#define MN_FIRST "1ºýÌܤΠ(ËâË¡½ñ)" 
-#define MN_SECOND "2ºýÌܤΠ(ËâË¡½ñ)" 
-#define MN_THIRD "3ºýÌܤΠ(ËâË¡½ñ)" 
-#define MN_FOURTH "4ºýÌܤΠ(ËâË¡½ñ)" 
-
-#define MN_NOUN "̾»ì¤ÎÁªÂò" 
+static char MN_QUIT[] = "セーブ無しで終了";
+static char MN_SAVEQUIT[] = "セーブして終了";
+static char MN_REVERT[] = "全ての変更を破棄";
+static char MN_HELP[] = "ヘルプ";
+
+static char MN_MOVE[] = "カーソル移動";
+static char MN_LEFT[] =   "左          (←矢印キー)";
+static char MN_DOWN[] =   "下          (↓矢印キー)";
+static char MN_UP[] =     "上          (↑矢印キー)";
+static char MN_RIGHT[] =  "右          (→矢印キー)";
+static char MN_BOL[] =    "行の先頭";
+static char MN_EOL[] =    "行の終端";
+static char MN_PGUP[] =   "上のページ  (PageUpキー)";
+static char MN_PGDOWN[] = "下のページ  (PageDownキー)";
+static char MN_TOP[] =    "1行目へ移動 (Homeキー)";
+static char MN_BOTTOM[] = "最下行へ移動(Endキー)";
+
+static char MN_EDIT[] = "編集";
+static char MN_CUT[] = "カット";
+static char MN_COPY[] = "コピー";
+static char MN_PASTE[] = "ペースト";
+static char MN_BLOCK[] = "選択範囲の指定";
+static char MN_KILL_LINE[] = "行の残りを削除";
+static char MN_DELETE_CHAR[] = "1文字削除";
+static char MN_BACKSPACE[] = "バックスペース";
+static char MN_RETURN[] = "改行";
+
+static char MN_SEARCH[] = "検索";
+static char MN_SEARCH_STR[] = "文字列で検索";
+static char MN_SEARCH_FORW[] = "前方へ再検索";
+static char MN_SEARCH_BACK[] = "後方へ再検索";
+static char MN_SEARCH_OBJ[] = "アイテムを選択して検索";
+static char MN_SEARCH_DESTROYED[] = "自動破壊されたアイテムで検索";
+
+static char MN_INSERT[] = "色々挿入";
+static char MN_INSERT_OBJECT[] = "選択したアイテムの名前を挿入";
+static char MN_INSERT_DESTROYED[] = "自動破壊されたアイテムの名前を挿入";
+static char MN_INSERT_BLOCK[] = "条件分岐ブロックの例を挿入";
+static char MN_INSERT_MACRO[] = "マクロ定義を挿入";
+static char MN_INSERT_KEYMAP[] = "キーマップ定義を挿入";
+
+static char MN_COMMAND_LETTER[] = "拾い/破壊/放置の選択";
+static char MN_CL_AUTOPICK[] = "「 」 (自動拾い)";
+static char MN_CL_DESTROY[] = "「!」 (自動破壊)";
+static char MN_CL_LEAVE[] = "「~」 (放置)";
+static char MN_CL_QUERY[] = "「;」 (確認して拾う)";
+static char MN_CL_NO_DISP[] = "「(」 (マップコマンドで表示しない)";
+
+static char MN_ADJECTIVE_GEN[] = "形容詞(一般)の選択";
+static char MN_RARE[] = "レアな (装備)";
+static char MN_COMMON[] = "ありふれた (装備)";
+
+static char MN_ADJECTIVE_SPECIAL[] = "形容詞(特殊)の選択";
+static char MN_BOOSTED[] = "ダイス目の違う (武器)";
+static char MN_MORE_DICE[] = "ダイス目 # 以上の (武器)";
+static char MN_MORE_BONUS[] = "修正値 # 以上の (指輪等)";
+static char MN_WANTED[] = "賞金首の (死体)";
+static char MN_UNIQUE[] = "ユニーク・モンスターの (死体)";
+static char MN_HUMAN[] = "人間の (死体)";
+static char MN_UNREADABLE[] = "読めない (魔法書)";
+static char MN_REALM1[] = "第一領域の (魔法書)";
+static char MN_REALM2[] = "第二領域の (魔法書)";
+static char MN_FIRST[] = "1冊目の (魔法書)";
+static char MN_SECOND[] = "2冊目の (魔法書)";
+static char MN_THIRD[] = "3冊目の (魔法書)";
+static char MN_FOURTH[] = "4冊目の (魔法書)";
+
+static char MN_NOUN[] = "名詞の選択";
 
 #else
 
-#define MN_QUIT "Quit without save" 
-#define MN_SAVEQUIT "Save & Quit" 
-#define MN_REVERT "Revert all changes" 
-#define MN_HELP "Help" 
-
-#define MN_MOVE   "Move cursor" 
-#define MN_LEFT   "Left     (Left Arrow key)" 
-#define MN_DOWN   "Down     (Down Arrow key)" 
-#define MN_UP     "Up       (Up Arrow key)" 
-#define MN_RIGHT  "Right    (Right Arrow key)" 
-#define MN_BOL    "Beggining of line" 
-#define MN_EOL    "End of line" 
-#define MN_PGUP   "Page up  (PageUp key)" 
-#define MN_PGDOWN "Page down(PageDown key)" 
-#define MN_TOP    "Top      (Home key)" 
-#define MN_BOTTOM "Bottom   (End key)" 
-
-#define MN_EDIT "Edit" 
-#define MN_CUT "Cut" 
-#define MN_COPY "Copy" 
-#define MN_PASTE "Paste" 
-#define MN_BLOCK "Select block" 
-#define MN_KILL_LINE "Kill rest of line" 
-#define MN_DELETE_CHAR "Delete character" 
-#define MN_BACKSPACE "Backspace" 
-#define MN_RETURN "Return" 
-#define MN_RETURN "Return" 
-
-#define MN_SEARCH "Search" 
-#define MN_SEARCH_STR "Search by string" 
-#define MN_SEARCH_FORW "Search forward" 
-#define MN_SEARCH_BACK "Search backward" 
-#define MN_SEARCH_OBJ "Search by inventory object" 
-#define MN_SEARCH_DESTROYED "Search by destroyed object" 
-
-#define MN_INSERT "Insert..." 
-#define MN_INSERT_OBJECT "Insert name of choosen object" 
-#define MN_INSERT_DESTROYED "Insert name of destroyed object" 
-#define MN_INSERT_BLOCK "Insert conditional block" 
-#define MN_INSERT_MACRO "Insert a macro definition" 
-#define MN_INSERT_KEYMAP "Insert a keymap definition" 
-
-#define MN_COMMAND_LETTER "Command letter" 
-#define MN_CL_AUTOPICK "' ' (Auto pick)" 
-#define MN_CL_DESTROY "'!' (Auto destroy)" 
-#define MN_CL_LEAVE "'~' (Leave it on the floor)" 
-#define MN_CL_QUERY "';' (Query to pick up)" 
-#define MN_CL_NO_DISP "'(' (No display on the large map)" 
-
-#define MN_ADJECTIVE_GEN "Adjective (general)" 
-
-#define MN_ADJECTIVE_SPECIAL "Adjective (special)" 
-#define MN_BOOSTED "dice boosted (weapons)" 
-#define MN_MORE_DICE "more than # dice (weapons)" 
-#define MN_MORE_BONUS "more bonus than # (rings etc.)" 
-#define MN_ARTIFACT "artifact (equipments)" 
-#define MN_EGO "ego (equipments)" 
-#define MN_NAMELESS "nameless (equipments)" 
-#define MN_RARE "rare (equipments)" 
-#define MN_COMMON "common (equipments)" 
-#define MN_WANTED "wanted (corpse)" 
-#define MN_UNIQUE "unique (corpse)" 
-#define MN_HUMAN "human (corpse)" 
-#define MN_UNREADABLE "unreadable (spellbooks)" 
-#define MN_REALM1 "realm1 (spellbooks)" 
-#define MN_REALM2 "realm2 (spellbooks)" 
-#define MN_FIRST "first (spellbooks)" 
-#define MN_SECOND "second (spellbooks)" 
-#define MN_THIRD "third (spellbooks)" 
-#define MN_FOURTH "fourth (spellbooks)" 
-
-#define MN_NOUN "Keywords (noun)" 
+static char MN_QUIT[] = "Quit without save";
+static char MN_SAVEQUIT[] = "Save & Quit";
+static char MN_REVERT[] = "Revert all changes";
+static char MN_HELP[] = "Help";
+
+static char MN_MOVE[] =   "Move cursor";
+static char MN_LEFT[] =   "Left     (Left Arrow key)";
+static char MN_DOWN[] =   "Down     (Down Arrow key)";
+static char MN_UP[] =     "Up       (Up Arrow key)";
+static char MN_RIGHT[] =  "Right    (Right Arrow key)";
+static char MN_BOL[] =    "Beggining of line";
+static char MN_EOL[] =    "End of line";
+static char MN_PGUP[] =   "Page up  (PageUp key)";
+static char MN_PGDOWN[] = "Page down(PageDown key)";
+static char MN_TOP[] =    "Top      (Home key)";
+static char MN_BOTTOM[] = "Bottom   (End key)";
+
+static char MN_EDIT[] = "Edit";
+static char MN_CUT[] = "Cut";
+static char MN_COPY[] = "Copy";
+static char MN_PASTE[] = "Paste";
+static char MN_BLOCK[] = "Select block";
+static char MN_KILL_LINE[] = "Kill rest of line";
+static char MN_DELETE_CHAR[] = "Delete character";
+static char MN_BACKSPACE[] = "Backspace";
+static char MN_RETURN[] = "Return";
+
+static char MN_SEARCH[] = "Search";
+static char MN_SEARCH_STR[] = "Search by string";
+static char MN_SEARCH_FORW[] = "Search forward";
+static char MN_SEARCH_BACK[] = "Search backward";
+static char MN_SEARCH_OBJ[] = "Search by inventory object";
+static char MN_SEARCH_DESTROYED[] = "Search by destroyed object";
+
+static char MN_INSERT[] = "Insert...";
+static char MN_INSERT_OBJECT[] = "Insert name of choosen object";
+static char MN_INSERT_DESTROYED[] = "Insert name of destroyed object";
+static char MN_INSERT_BLOCK[] = "Insert conditional block";
+static char MN_INSERT_MACRO[] = "Insert a macro definition";
+static char MN_INSERT_KEYMAP[] = "Insert a keymap definition";
+
+static char MN_COMMAND_LETTER[] = "Command letter";
+static char MN_CL_AUTOPICK[] = "' ' (Auto pick)";
+static char MN_CL_DESTROY[] = "'!' (Auto destroy)";
+static char MN_CL_LEAVE[] = "'~' (Leave it on the floor)";
+static char MN_CL_QUERY[] = "';' (Query to pick up)";
+static char MN_CL_NO_DISP[] = "'(' (No display on the large map)";
+
+static char MN_ADJECTIVE_GEN[] = "Adjective (general)";
+static char MN_RARE[] = "rare (equipments)";
+static char MN_COMMON[] = "common (equipments)";
+
+static char MN_ADJECTIVE_SPECIAL[] = "Adjective (special)";
+static char MN_BOOSTED[] = "dice boosted (weapons)";
+static char MN_MORE_DICE[] = "more than # dice (weapons)";
+static char MN_MORE_BONUS[] = "more bonus than # (rings etc.)";
+static char MN_WANTED[] = "wanted (corpse)";
+static char MN_UNIQUE[] = "unique (corpse)";
+static char MN_HUMAN[] = "human (corpse)";
+static char MN_UNREADABLE[] = "unreadable (spellbooks)";
+static char MN_REALM1[] = "realm1 (spellbooks)";
+static char MN_REALM2[] = "realm2 (spellbooks)";
+static char MN_FIRST[] = "first (spellbooks)";
+static char MN_SECOND[] = "second (spellbooks)";
+static char MN_THIRD[] = "third (spellbooks)";
+static char MN_FOURTH[] = "fourth (spellbooks)";
+
+static char MN_NOUN[] = "Keywords (noun)";
 
 #endif
 
@@ -4160,17 +4072,19 @@ command_menu_type menu_data[] =
        {KEY_IDENTIFIED, 1, -1, EC_IK_IDENTIFIED},
        {KEY_STAR_IDENTIFIED, 1, -1, EC_IK_STAR_IDENTIFIED},
        {KEY_COLLECTING, 1, -1, EC_OK_COLLECTING},
+       {KEY_ARTIFACT, 1, -1, EC_OK_ARTIFACT},
+       {KEY_EGO, 1, -1, EC_OK_EGO},
+       {KEY_GOOD, 1, -1, EC_OK_GOOD},
+       {KEY_NAMELESS, 1, -1, EC_OK_NAMELESS},
+       {KEY_AVERAGE, 1, -1, EC_OK_AVERAGE},
        {KEY_WORTHLESS, 1, -1, EC_OK_WORTHLESS},
+       {MN_RARE, 1, -1, EC_OK_RARE},
+       {MN_COMMON, 1, -1, EC_OK_COMMON},
 
        {MN_ADJECTIVE_SPECIAL, 0, -1, -1},
        {MN_BOOSTED, 1, -1, EC_OK_BOOSTED},
        {MN_MORE_DICE, 1, -1, EC_OK_MORE_DICE},
        {MN_MORE_BONUS, 1, -1, EC_OK_MORE_BONUS},
-       {MN_ARTIFACT, 1, -1, EC_OK_ARTIFACT},
-       {MN_EGO, 1, -1, EC_OK_EGO},
-       {MN_NAMELESS, 1, -1, EC_OK_NAMELESS},
-       {MN_RARE, 1, -1, EC_OK_RARE},
-       {MN_COMMON, 1, -1, EC_OK_COMMON},
        {MN_WANTED, 1, -1, EC_OK_WANTED},
        {MN_UNIQUE, 1, -1, EC_OK_UNIQUE},
        {MN_HUMAN, 1, -1, EC_OK_HUMAN},
@@ -4308,11 +4222,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)
                                {
@@ -4338,11 +4248,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;
@@ -4440,6 +4346,91 @@ static void add_str_to_yank(text_body_type *tb, cptr str)
 }
 
 
+/*
+ * Do work for the copy editor-command
+ */
+static void copy_text_to_yank(text_body_type *tb)
+{
+       int len = strlen(tb->lines_list[tb->cy]);
+
+       /* Correct cursor location */
+       if (tb->cx > len) tb->cx = len;
+
+       /* Use single line? */
+       if (!tb->mark)
+       {
+               /* Select a single line */
+               tb->cx = 0;
+               tb->my = tb->cy;
+               tb->mx = len;
+       }
+
+       /* Kill old yank buffer */
+       kill_yank_chain(tb);
+
+
+       /* Single line case */
+       if (tb->my == tb->cy)
+       {
+               int i;
+               char buf[MAX_LINELEN];
+               int bx1 = MIN(tb->mx, tb->cx);
+               int bx2 = MAX(tb->mx, tb->cx);
+
+               /* Correct fake cursor position */
+               if (bx2 > len) bx2 = len;
+
+               /* Whole part of this line is selected */
+               if (bx1 == 0 && bx2 == len)
+               {
+                       /* Copy this line */
+                       add_str_to_yank(tb, tb->lines_list[tb->cy]);
+
+                       /* Add end of line to the buffer */
+                       add_str_to_yank(tb, "");
+               }
+
+               /* Segment of this line is selected */
+               else
+               {
+                       for (i = 0; i < bx2 - bx1; i++)
+                       {
+                               buf[i] = tb->lines_list[tb->cy][bx1 + i];
+                       }
+                       buf[i] = '\0';
+
+                       /* Copy this segment of line */
+                       add_str_to_yank(tb, buf);
+               }
+       }
+
+       /* Multiple lines case */
+       else /* if (tb->my != tb->cy) */
+       {
+               int y;
+
+               int by1 = MIN(tb->my, tb->cy);
+               int by2 = MAX(tb->my, tb->cy);
+
+               /* Copy lines */
+               for (y = by1; y <= by2; y++)
+               {
+                       /* Copy this line */
+                       add_str_to_yank(tb, tb->lines_list[y]);
+               }
+
+               /* Add final end of line to the buffer */
+               add_str_to_yank(tb, "");
+       }
+
+       /* Disable selection */
+       tb->mark = 0;
+
+       /* Now dirty */
+       tb->dirty_flags |= DIRTY_ALL;
+}
+
+
 #define DESCRIPT_HGT 3
 
 /*
@@ -4450,7 +4441,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);
 
        /*
@@ -4467,7 +4457,12 @@ static void draw_text_editor(text_body_type *tb)
                        i++;
                        if (i == tb->cx)
                        {
-                               tb->cx--;
+                               /*
+                                * Move to a correct position in the
+                                * left or right
+                                */
+                               if (i & 1) tb->cx--;
+                               else tb->cx++;
                                break;
                        }
                }
@@ -4525,6 +4520,8 @@ static void draw_text_editor(text_body_type *tb)
                        char f;
                        cptr v;
                        cptr s = tb->lines_list[y];
+                       char *ss, *s_keep;
+                       int s_len;
 
                        /* Update this line's state */
                        tb->states[y] = state;
@@ -4536,13 +4533,20 @@ static void draw_text_editor(text_body_type *tb)
                        if (streq(s, "$AUTOREGISTER"))
                                state |= LSTAT_AUTOREGISTER;
 
+                       s_len = strlen(s);
+                       ss = (char *)string_make(s);
+                       s_keep = ss;
+
                        /* Parse the expr */
-                       v = process_pref_file_expr(&s, &f);
+                       v = process_pref_file_expr(&ss, &f);
 
                        /* Set flag */
                        if (streq(v, "0")) state |= LSTAT_BYPASS;
                        else state &= ~LSTAT_BYPASS;
 
+                       /* Cannot use string_free() because the string was "destroyed" */
+                       C_KILL(s_keep, s_len + 1, char);
+
                        /* Re-update this line's state */
                        tb->states[y] = state | LSTAT_EXPRESSION;
                }
@@ -4552,12 +4556,6 @@ static void draw_text_editor(text_body_type *tb)
 
        if (tb->mark)
        {
-               int tmp_cx = tb->cx;
-               int len = strlen(tb->lines_list[tb->cy]);
-
-               /* Correct cursor location */
-               if (tb->cx > len) tmp_cx = len;
-
                tb->dirty_flags |= DIRTY_ALL;
 
                by1 = MIN(tb->my, tb->cy);
@@ -4668,76 +4666,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][1] == ':')
+               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;
                        }
 
@@ -4746,39 +4709,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;
                        }
@@ -4795,20 +4742,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));
@@ -4910,7 +4849,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;
@@ -4925,7 +4864,6 @@ static bool insert_macro_line(text_body_type *tb)
        /* Terminate */
        buf[n] = '\0';
 
-       /* Flush */
        flush();
 
        /* Convert the trigger */
@@ -4971,7 +4909,7 @@ static bool insert_keymap_line(text_body_type *tb)
 {
        char tmp[1024];
        char buf[2];
-       int mode;
+       BIT_FLAGS mode;
        cptr act;
 
        /* Roguelike */
@@ -4986,14 +4924,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 */
@@ -5012,10 +4948,22 @@ static bool insert_keymap_line(text_body_type *tb)
        /* Look up the keymap */
        act = keymap_act[mode][(byte)(buf[0])];
 
+       if (act)
+       {
+               /* Analyze the current action */
+               ascii_to_text(tmp, act);
+       }
+       else
+       {
+               /* No keymap defined -- Use trigger key itself as a default */
+
+               /* Nothing to do (use tmp) */
+       }
+
        /* Insert blank action preference line */
        insert_return_code(tb);
        string_free(tb->lines_list[tb->cy]);
-       tb->lines_list[tb->cy] = string_make(format("A:%s", act));
+       tb->lines_list[tb->cy] = string_make(format("A:%s", tmp));
 
        return TRUE;
 }
@@ -5031,11 +4979,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;
 
@@ -5044,11 +4989,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);
@@ -5062,11 +5004,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;
 
@@ -5097,10 +5035,30 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                if (0 < tb->cx)
                {
                        int len;
+#ifdef JP
+                       int i;
+#endif
 
                        tb->cx--;
                        len = strlen(tb->lines_list[tb->cy]);
                        if (len < tb->cx) tb->cx = len;
+
+#ifdef JP
+                       /* Don't let cursor at second byte of kanji */
+                       for (i = 0; tb->lines_list[tb->cy][i]; i++)
+                       {
+                               if (iskanji(tb->lines_list[tb->cy][i]))
+                               {
+                                       i++;
+                                       if (i == tb->cx)
+                                       {
+                                               /* Move to the left */
+                                               tb->cx--;
+                                               break;
+                                       }
+                               }
+                       }
+#endif
                }
                else if (tb->cy > 0)
                {
@@ -5111,7 +5069,17 @@ static bool do_editor_command(text_body_type *tb, int com_id)
 
        case EC_DOWN:
                /* Next line */
-               if (tb->lines_list[tb->cy + 1]) tb->cy++;
+
+               /* Is this the last line? */
+               if (!tb->lines_list[tb->cy + 1])
+               {
+                       /* Add one more empty line if possible */
+                       if (!add_empty_line(tb)) break;
+               }
+
+               /* Go down */
+               tb->cy++;
+
                break;
 
        case EC_UP:
@@ -5131,13 +5099,19 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                len = strlen(tb->lines_list[tb->cy]);
                if (len < tb->cx)
                {
-                       if (tb->lines_list[tb->cy + 1])
+                       /* Correct the cursor position */
+                       tb->cx = len;
+
+                       /* Is this the last line? */
+                       if (!tb->lines_list[tb->cy + 1])
                        {
-                               tb->cy++;
-                               tb->cx = 0;
+                               /* Add one more empty line if possible */
+                               if (!add_empty_line(tb)) break;
                        }
-                       else
-                               tb->cx = len;
+
+                       /* Move to the beginning of next line */
+                       tb->cy++;
+                       tb->cx = 0;
                }
                break;
        }
@@ -5161,8 +5135,18 @@ static bool do_editor_command(text_body_type *tb, int com_id)
 
        case EC_PGDOWN:
                /* Page down */
-               while (tb->cy < tb->upper + tb->hgt && tb->lines_list[tb->cy + 1])
+               while (tb->cy < tb->upper + tb->hgt)
+               {
+                       /* Is this the last line? */
+                       if (!tb->lines_list[tb->cy + 1])
+                       {
+                               /* Add one more empty line if possible */
+                               if (!add_empty_line(tb)) break;
+                       }
+
                        tb->cy++;
+               }
+
                tb->upper = tb->cy;
                break;
 
@@ -5171,14 +5155,27 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                break;
 
        case EC_BOTTOM:
-               while (tb->lines_list[tb->cy + 1])
+               while (TRUE)
+               {
+                       /* Is this the last line? */
+                       if (!tb->lines_list[tb->cy + 1])
+                       {
+                               /* Add one more empty line if possible */
+                               if (!add_empty_line(tb)) break;
+                       }
+
                        tb->cy++;
+               }
+
+               /* Always at the biginning of the last line */
+               tb->cx = 0;
+
                break;
 
        case EC_CUT:
        {       
                /* Copy the text first */
-               do_editor_command(tb, EC_COPY);
+               copy_text_to_yank(tb);
 
                /* Single line case */
                if (tb->my == tb->cy)
@@ -5224,90 +5221,58 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                /* Now dirty */
                tb->dirty_flags |= DIRTY_ALL;
 
+               /* Text is changed */
+               tb->changed = TRUE;
+
                break;
        }
 
        case EC_COPY:
-       {       
-               int len = strlen(tb->lines_list[tb->cy]);
-
-               /* Correct cursor location */
-               if (tb->cx > len) tb->cx = len;
-
-               /* Use single line? */
-               if (!tb->mark)
-               {
-                       /* Select a single line */
-                       tb->cx = 0;
-                       tb->my = tb->cy;
-                       tb->mx = len;
-               }
+               copy_text_to_yank(tb);
 
-               /* Kill old yank buffer */
-               kill_yank_chain(tb);
-
-
-               /* Single line case */
+               /*
+                * Move cursor position to the end of the selection
+                *
+                * Pressing ^C ^V correctly duplicates the selection.
+                */
                if (tb->my == tb->cy)
                {
-                       int i;
-                       char buf[MAX_LINELEN];
-                       int bx1 = MIN(tb->mx, tb->cx);
-                       int bx2 = MAX(tb->mx, tb->cx);
-
-                       /* Correct fake cursor position */
-                       if (bx2 > len) bx2 = len;
+                       tb->cx = MAX(tb->cx, tb->mx);
 
-                       /* Whole part of this line is selected */
-                       if (bx1 == 0 && bx2 == len)
+                       /*
+                        * When whole line is selected, the end of
+                        * line code is also copyed.
+                        */
+                       if (!tb->lines_list[tb->cy][tb->cx])
                        {
-                               /* Copy this line */
-                               add_str_to_yank(tb, tb->lines_list[tb->cy]);
-
-                               /* Add end of line to the buffer */
-                               add_str_to_yank(tb, "");
-                       }
-
-                       /* Segment of this line is selected */
-                       else
-                       {
-                               for (i = 0; i < bx2 - bx1; i++)
+                               /* Is this the last line? */
+                               if (!tb->lines_list[tb->cy + 1])
                                {
-                                       buf[i] = tb->lines_list[tb->cy][bx1 + i];
+                                       /* Add one more empty line if possible */
+                                       if (!add_empty_line(tb)) break;
                                }
-                               buf[i] = '\0';
 
-                               /* Copy this segment of line */
-                               add_str_to_yank(tb, buf);
+                               /* Go to the beginning of next line */
+                               tb->cy++;
+                               tb->cx = 0;
                        }
                }
-
-               /* Multiple lines case */
-               else /* if (tb->my != tb->cy) */
+               else
                {
-                       int y;
+                       tb->cy = MAX(tb->cy, tb->my);
 
-                       int by1 = MIN(tb->my, tb->cy);
-                       int by2 = MAX(tb->my, tb->cy);
-
-                       /* Copy lines */
-                       for (y = by1; y <= by2; y++)
+                       /* Is this the last line? */
+                       if (!tb->lines_list[tb->cy + 1])
                        {
-                               /* Copy this line */
-                               add_str_to_yank(tb, tb->lines_list[y]);
+                               /* Add one more empty line if possible */
+                               if (!add_empty_line(tb)) break;
                        }
 
-                       /* Add final end of line to the buffer */
-                       add_str_to_yank(tb, "");
+                       /* Go down */
+                       tb->cy++;
                }
 
-               /* Disable selection */
-               tb->mark = 0;
-
-               /* Now dirty */
-               tb->dirty_flags |= DIRTY_ALL;
                break;
-       }
 
        case EC_PASTE:
        {
@@ -5769,11 +5734,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 */
@@ -5796,11 +5757,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))
                {
@@ -5850,7 +5808,9 @@ static bool do_editor_command(text_body_type *tb, int com_id)
        case EC_OK_WORTHLESS: toggle_keyword(tb, FLG_WORTHLESS); break;
        case EC_OK_ARTIFACT: toggle_keyword(tb, FLG_ARTIFACT); break;
        case EC_OK_EGO: toggle_keyword(tb, FLG_EGO); break;
+       case EC_OK_GOOD: toggle_keyword(tb, FLG_GOOD); break;
        case EC_OK_NAMELESS: toggle_keyword(tb, FLG_NAMELESS); break;
+       case EC_OK_AVERAGE: toggle_keyword(tb, FLG_AVERAGE); break;
        case EC_OK_RARE: toggle_keyword(tb, FLG_RARE); break;
        case EC_OK_COMMON: toggle_keyword(tb, FLG_COMMON); break;
        case EC_OK_WANTED: toggle_keyword(tb, FLG_WANTED); break;
@@ -5915,8 +5875,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
@@ -5926,7 +5886,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++;
        }
 
@@ -6065,6 +6025,11 @@ void do_cmd_edit_autopick(void)
        tb->dirty_line = -1;
        tb->filename_mode = PT_DEFAULT;
 
+       if (turn < old_autosave_turn)
+       {
+               while (old_autosave_turn > turn) old_autosave_turn -= TURNS_PER_TICK * TOWN_DAWN;
+       }
+
        /* Autosave */
        if (turn > old_autosave_turn + 100L)
        {
@@ -6110,11 +6075,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 */
@@ -6180,7 +6142,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);
@@ -6197,6 +6159,7 @@ void do_cmd_edit_autopick(void)
 
        free_text_lines(tb->lines_list);
 
+       string_free(tb->search_str);
        string_free(tb->last_destroyed);
 
        /* Destroy string chain */
@@ -6206,7 +6169,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;