OSDN Git Service

[Refactor] #38861 cptr を concptrに改名 / rename cptr to concptr.
[hengband/hengband.git] / src / files.c
index c7d2923..8a894c0 100644 (file)
@@ -14,6 +14,9 @@
 
 
 #include "angband.h"
+#include "world.h"
+#include "player-status.h"
+#include "sort.h"
 
 
 /*
@@ -122,9 +125,9 @@ void safe_setuid_grab(void)
  * Hack -- We will always extract at least one token
  * </pre>
  */
-s16b tokenize(char *buf, s16b num, char **tokens, int mode)
+s16b tokenize(char *buf, s16b num, char **tokens, BIT_FLAGS mode)
 {
-       int i = 0;
+       s16b i = 0;
 
        char *s = buf;
 
@@ -189,7 +192,7 @@ typedef struct named_num named_num;
 
 struct named_num
 {
-       cptr name;              /* The name of this thing */
+       concptr name;           /* The name of this thing */
        int num;                        /* A number associated with it */
 };
 
@@ -202,27 +205,27 @@ static named_num gf_desc[] =
        {"GF_ACID",                             GF_ACID                         },
        {"GF_COLD",                             GF_COLD                         },
        {"GF_FIRE",                                     GF_FIRE                         },
-       {"GF_PSY_SPEAR",                        GF_PSY_SPEAR                    },
+       {"GF_PSY_SPEAR",                        GF_PSY_SPEAR            },
        {"GF_MISSILE",                          GF_MISSILE                      },
-       {"GF_ARROW",                            GF_ARROW                                },
+       {"GF_ARROW",                            GF_ARROW                        },
        {"GF_PLASMA",                           GF_PLASMA                       },
-       {"GF_WATER",                            GF_WATER                                },
+       {"GF_WATER",                            GF_WATER                        },
        {"GF_LITE",                                     GF_LITE                         },
        {"GF_DARK",                                     GF_DARK                         },
        {"GF_LITE_WEAK",                        GF_LITE_WEAK            },
        {"GF_DARK_WEAK",                        GF_DARK_WEAK            },
        {"GF_SHARDS",                           GF_SHARDS                       },
-       {"GF_SOUND",                            GF_SOUND                                },
+       {"GF_SOUND",                            GF_SOUND                        },
        {"GF_CONFUSION",                        GF_CONFUSION            },
-       {"GF_FORCE",                            GF_FORCE                                },
+       {"GF_FORCE",                            GF_FORCE                        },
        {"GF_INERTIA",                          GF_INERTIAL                     },
        {"GF_MANA",                                     GF_MANA                         },
        {"GF_METEOR",                           GF_METEOR                       },
        {"GF_ICE",                                      GF_ICE                          },
-       {"GF_CHAOS",                            GF_CHAOS                                },
+       {"GF_CHAOS",                            GF_CHAOS                        },
        {"GF_NETHER",                           GF_NETHER                       },
        {"GF_DISENCHANT",                       GF_DISENCHANT           },
-       {"GF_NEXUS",                            GF_NEXUS                                },
+       {"GF_NEXUS",                            GF_NEXUS                        },
        {"GF_TIME",                                     GF_TIME                         },
        {"GF_GRAVITY",                          GF_GRAVITY                      },
        {"GF_KILL_WALL",                        GF_KILL_WALL            },
@@ -233,24 +236,24 @@ static named_num gf_desc[] =
        {"GF_MAKE_TRAP",                        GF_MAKE_TRAP            },
        {"GF_MAKE_TREE",                        GF_MAKE_TREE            },
        {"GF_OLD_CLONE",                        GF_OLD_CLONE            },
-       {"GF_OLD_POLY",                 GF_OLD_POLY                     },
-       {"GF_OLD_HEAL",                 GF_OLD_HEAL                     },
+       {"GF_OLD_POLY",                         GF_OLD_POLY                     },
+       {"GF_OLD_HEAL",                         GF_OLD_HEAL                     },
        {"GF_OLD_SPEED",                        GF_OLD_SPEED            },
-       {"GF_OLD_SLOW",                 GF_OLD_SLOW                     },
-       {"GF_OLD_CONF",                 GF_OLD_CONF                     },
+       {"GF_OLD_SLOW",                         GF_OLD_SLOW                     },
+       {"GF_OLD_CONF",                         GF_OLD_CONF                     },
        {"GF_OLD_SLEEP",                        GF_OLD_SLEEP            },
-       {"GF_OLD_DRAIN",                        GF_OLD_DRAIN            },
-       {"GF_AWAY_UNDEAD",              GF_AWAY_UNDEAD          },
+       {"GF_HYPODYNAMIA",                      GF_HYPODYNAMIA          },
+       {"GF_AWAY_UNDEAD",                      GF_AWAY_UNDEAD          },
        {"GF_AWAY_EVIL",                        GF_AWAY_EVIL            },
-       {"GF_AWAY_ALL",                 GF_AWAY_ALL                     },
-       {"GF_TURN_UNDEAD",              GF_TURN_UNDEAD          },
+       {"GF_AWAY_ALL",                         GF_AWAY_ALL                     },
+       {"GF_TURN_UNDEAD",                      GF_TURN_UNDEAD          },
        {"GF_TURN_EVIL",                        GF_TURN_EVIL            },
-       {"GF_TURN_ALL",                 GF_TURN_ALL                     },
-       {"GF_DISP_UNDEAD",              GF_DISP_UNDEAD          },
+       {"GF_TURN_ALL",                         GF_TURN_ALL                     },
+       {"GF_DISP_UNDEAD",                      GF_DISP_UNDEAD          },
        {"GF_DISP_EVIL",                        GF_DISP_EVIL            },
-       {"GF_DISP_ALL",                 GF_DISP_ALL                     },
+       {"GF_DISP_ALL",                         GF_DISP_ALL                     },
        {"GF_DISP_DEMON",                       GF_DISP_DEMON           },
-       {"GF_DISP_LIVING",              GF_DISP_LIVING          },
+       {"GF_DISP_LIVING",                      GF_DISP_LIVING          },
        {"GF_ROCKET",                           GF_ROCKET                       },
        {"GF_NUKE",                                     GF_NUKE                         },
        {"GF_MAKE_GLYPH",                       GF_MAKE_GLYPH           },
@@ -260,43 +263,43 @@ static named_num gf_desc[] =
        {"GF_STUN",                                     GF_STUN                         },
        {"GF_HOLY_FIRE",                        GF_HOLY_FIRE            },
        {"GF_HELL_FIRE",                        GF_HELL_FIRE            },
-       {"GF_DISINTEGRATE",             GF_DISINTEGRATE },
-       {"GF_CHARM",                            GF_CHARM                                },
-       {"GF_CONTROL_UNDEAD",   GF_CONTROL_UNDEAD       },
-       {"GF_CONTROL_ANIMAL",   GF_CONTROL_ANIMAL       },
+       {"GF_DISINTEGRATE",                     GF_DISINTEGRATE         },
+       {"GF_CHARM",                            GF_CHARM                        },
+       {"GF_CONTROL_UNDEAD",           GF_CONTROL_UNDEAD       },
+       {"GF_CONTROL_ANIMAL",           GF_CONTROL_ANIMAL       },
        {"GF_PSI",                                      GF_PSI                          },
        {"GF_PSI_DRAIN",                        GF_PSI_DRAIN            },
-       {"GF_TELEKINESIS",              GF_TELEKINESIS          },
-       {"GF_JAM_DOOR",                 GF_JAM_DOOR                     },
+       {"GF_TELEKINESIS",                      GF_TELEKINESIS          },
+       {"GF_JAM_DOOR",                         GF_JAM_DOOR                     },
        {"GF_DOMINATION",                       GF_DOMINATION           },
        {"GF_DISP_GOOD",                        GF_DISP_GOOD            },
        {"GF_DRAIN_MANA",                       GF_DRAIN_MANA           },
        {"GF_MIND_BLAST",                       GF_MIND_BLAST           },
        {"GF_BRAIN_SMASH",                      GF_BRAIN_SMASH          },
-       {"GF_CAUSE_1",                  GF_CAUSE_1              },
-       {"GF_CAUSE_2",                  GF_CAUSE_2              },
-       {"GF_CAUSE_3",                  GF_CAUSE_3              },
-       {"GF_CAUSE_4",                  GF_CAUSE_4              },
+       {"GF_CAUSE_1",                          GF_CAUSE_1                      },
+       {"GF_CAUSE_2",                          GF_CAUSE_2                      },
+       {"GF_CAUSE_3",                          GF_CAUSE_3                      },
+       {"GF_CAUSE_4",                          GF_CAUSE_4                      },
        {"GF_HAND_DOOM",                        GF_HAND_DOOM            },
-       {"GF_CAPTURE",                  GF_CAPTURE              },
+       {"GF_CAPTURE",                          GF_CAPTURE                      },
        {"GF_ANIM_DEAD",                        GF_ANIM_DEAD            },
-       {"GF_CONTROL_LIVING",           GF_CONTROL_LIVING       },
-       {"GF_IDENTIFY",                 GF_IDENTIFY     },
-       {"GF_ATTACK",                   GF_ATTACK       },
-       {"GF_ENGETSU",                  GF_ENGETSU      },
-       {"GF_GENOCIDE",                 GF_GENOCIDE     },
-       {"GF_PHOTO",                    GF_PHOTO        },
-       {"GF_CONTROL_DEMON",    GF_CONTROL_DEMON        },
-       {"GF_LAVA_FLOW",        GF_LAVA_FLOW    },
-       {"GF_BLOOD_CURSE",      GF_BLOOD_CURSE  },
-       {"GF_SEEKER",                   GF_SEEKER                       },
-       {"GF_SUPER_RAY",                GF_SUPER_RAY                    },
-       {"GF_STAR_HEAL",                GF_STAR_HEAL                    },
-       {"GF_WATER_FLOW",               GF_WATER_FLOW                   },
-       {"GF_CRUSADE",          GF_CRUSADE                      },
+       {"GF_CHARM_LIVING",                     GF_CHARM_LIVING         },
+       {"GF_IDENTIFY",                         GF_IDENTIFY                     },
+       {"GF_ATTACK",                           GF_ATTACK                       },
+       {"GF_ENGETSU",                          GF_ENGETSU                      },
+       {"GF_GENOCIDE",                         GF_GENOCIDE                     },
+       {"GF_PHOTO",                            GF_PHOTO                        },
+       {"GF_CONTROL_DEMON",            GF_CONTROL_DEMON        },
+       {"GF_LAVA_FLOW",                        GF_LAVA_FLOW            },
+       {"GF_BLOOD_CURSE",                      GF_BLOOD_CURSE          },
+       {"GF_SEEKER",                           GF_SEEKER                       },
+       {"GF_SUPER_RAY",                        GF_SUPER_RAY            },
+       {"GF_STAR_HEAL",                        GF_STAR_HEAL            },
+       {"GF_WATER_FLOW",                       GF_WATER_FLOW           },
+       {"GF_CRUSADE",                          GF_CRUSADE                      },
        {"GF_STASIS_EVIL",                      GF_STASIS_EVIL          },
-       {"GF_WOUNDS",                   GF_WOUNDS               },
-       {NULL,                                          0                                               }
+       {"GF_WOUNDS",                           GF_WOUNDS                       },
+       {NULL,                                          0                                       }
 };
 
 
@@ -356,7 +359,7 @@ static named_num gf_desc[] =
 errr process_pref_file_command(char *buf)
 {
        int i, j;
-       SYMBOL_COLOR n1;
+       TERM_COLOR n1;
        SYMBOL_CODE n2;
 
 
@@ -381,8 +384,8 @@ errr process_pref_file_command(char *buf)
                        {
                                monster_race *r_ptr;
                                i = (huge)strtol(zz[0], NULL, 0);
-                               n1 = strtol(zz[1], NULL, 0);
-                               n2 = strtol(zz[2], NULL, 0);
+                               n1 = (TERM_COLOR)strtol(zz[1], NULL, 0);
+                               n2 = (SYMBOL_CODE)strtol(zz[2], NULL, 0);
                                if (i >= max_r_idx) return 1;
                                r_ptr = &r_info[i];
                                if (n1 || (!(n2 & 0x80) && n2)) r_ptr->x_attr = n1; /* Allow TERM_DARK text */
@@ -397,8 +400,8 @@ errr process_pref_file_command(char *buf)
                        {
                                object_kind *k_ptr;
                                i = (huge)strtol(zz[0], NULL, 0);
-                               n1 = strtol(zz[1], NULL, 0);
-                               n2 = strtol(zz[2], NULL, 0);
+                               n1 = (TERM_COLOR)strtol(zz[1], NULL, 0);
+                               n2 = (SYMBOL_CODE)strtol(zz[2], NULL, 0);
                                if (i >= max_k_idx) return 1;
                                k_ptr = &k_info[i];
                                if (n1 || (!(n2 & 0x80) && n2)) k_ptr->x_attr = n1; /* Allow TERM_DARK text */
@@ -423,8 +426,8 @@ errr process_pref_file_command(char *buf)
                                if (i >= max_f_idx) return 1;
                                f_ptr = &f_info[i];
 
-                               n1 = strtol(zz[1], NULL, 0);
-                               n2 = strtol(zz[2], NULL, 0);
+                               n1 = (TERM_COLOR)strtol(zz[1], NULL, 0);
+                               n2 = (SYMBOL_CODE)strtol(zz[2], NULL, 0);
                                if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[F_LIT_STANDARD] = n1; /* Allow TERM_DARK text */
                                if (n2) f_ptr->x_char[F_LIT_STANDARD] = n2;
 
@@ -451,8 +454,8 @@ errr process_pref_file_command(char *buf)
                                case F_LIT_MAX * 2 + 1:
                                        for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
                                        {
-                                               n1 = strtol(zz[j * 2 + 1], NULL, 0);
-                                               n2 = strtol(zz[j * 2 + 2], NULL, 0);
+                                               n1 = (TERM_COLOR)strtol(zz[j * 2 + 1], NULL, 0);
+                                               n2 = (SYMBOL_CODE)strtol(zz[j * 2 + 2], NULL, 0);
                                                if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[j] = n1; /* Allow TERM_DARK text */
                                                if (n2) f_ptr->x_char[j] = n2;
                                        }
@@ -466,8 +469,8 @@ errr process_pref_file_command(char *buf)
                        if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
                        {
                                j = (byte)strtol(zz[0], NULL, 0);
-                               n1 = strtol(zz[1], NULL, 0);
-                               n2 = strtol(zz[2], NULL, 0);
+                               n1 = (TERM_COLOR)strtol(zz[1], NULL, 0);
+                               n2 = (SYMBOL_CODE)strtol(zz[2], NULL, 0);
                                misc_to_attr[j] = n1;
                                misc_to_char[j] = n2;
                                return 0;
@@ -479,7 +482,7 @@ errr process_pref_file_command(char *buf)
                        if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
                        {
                                j = (huge)strtol(zz[0], NULL, 0);
-                               n1 = (SYMBOL_COLOR)strtol(zz[1], NULL, 0);
+                               n1 = (TERM_COLOR)strtol(zz[1], NULL, 0);
                                n2 = (SYMBOL_CODE)strtol(zz[2], NULL, 0);
                                for (i = 1; i < max_k_idx; i++)
                                {
@@ -499,7 +502,7 @@ errr process_pref_file_command(char *buf)
                        if (tokenize(buf+2, 2, zz, TOKENIZE_CHECKQUOTE) == 2)
                        {
                                j = (byte)strtol(zz[0], NULL, 0) % 128;
-                               n1 = strtol(zz[1], NULL, 0);
+                               n1 = (TERM_COLOR)strtol(zz[1], NULL, 0);
                                if (n1) tval_to_attr[j] = n1;
                                return 0;
                        }
@@ -603,7 +606,6 @@ errr process_pref_file_command(char *buf)
                        /* Find the colon */
                        char *t = my_strchr(buf + 2, ':');
 
-                       /* Oops */
                        if (!t) return 1;
 
                        /* Nuke the colon */
@@ -755,9 +757,9 @@ errr process_pref_file_command(char *buf)
  *   result
  * </pre>
  */
-cptr process_pref_file_expr(char **sp, char *fp)
+concptr process_pref_file_expr(char **sp, char *fp)
 {
-       cptr v;
+       concptr v;
 
        char *b;
        char *s;
@@ -766,7 +768,7 @@ cptr process_pref_file_expr(char **sp, char *fp)
        char b2 = ']';
 
        char f = ' ';
-       static char tmp[10];
+       static char tmp[16];
 
        /* Initial */
        s = (*sp);
@@ -783,8 +785,8 @@ cptr process_pref_file_expr(char **sp, char *fp)
        /* Analyze */
        if (*s == b1)
        {
-               const char *p;
-               const char *t;
+               concptr p;
+               concptr t;
 
                /* Skip b1 */
                s++;
@@ -792,7 +794,6 @@ cptr process_pref_file_expr(char **sp, char *fp)
                /* First */
                t = process_pref_file_expr(&s, &f);
 
-               /* Oops */
                if (!*t)
                {
                        /* Nothing */
@@ -880,7 +881,6 @@ cptr process_pref_file_expr(char **sp, char *fp)
                        }
                }
 
-               /* Oops */
                else
                {
                        while (*s && (f != b2))
@@ -1036,11 +1036,7 @@ cptr process_pref_file_expr(char **sp, char *fp)
 
        /* Save */
        (*fp) = f;
-
-       /* Save */
        (*sp) = s;
-
-       /* Result */
        return (v);
 }
 
@@ -1064,7 +1060,7 @@ cptr process_pref_file_expr(char **sp, char *fp)
  *   result
  * </pre>
  */
-static errr process_pref_file_aux(cptr name, int preftype)
+static errr process_pref_file_aux(concptr name, int preftype)
 {
        FILE *fp;
 
@@ -1112,7 +1108,7 @@ static errr process_pref_file_aux(cptr name, int preftype)
                if ((buf[0] == '?') && (buf[1] == ':'))
                {
                        char f;
-                       cptr v;
+                       concptr v;
                        char *s;
 
                        /* Start */
@@ -1123,8 +1119,6 @@ static errr process_pref_file_aux(cptr name, int preftype)
 
                        /* Set flag */
                        bypass = (streq(v, "0") ? TRUE : FALSE);
-
-                       /* Continue */
                        continue;
                }
 
@@ -1159,8 +1153,6 @@ static errr process_pref_file_aux(cptr name, int preftype)
 
                        /* Set back depth level */
                        depth_count--;
-
-                       /* Continue */
                        continue;
                }
 
@@ -1188,11 +1180,7 @@ static errr process_pref_file_aux(cptr name, int preftype)
                msg_format(_("('%s'を解析中)", "Parsing '%s'"), old);
                msg_print(NULL);
        }
-
-       /* Close the file */
        my_fclose(fp);
-
-       /* Result */
        return (err);
 }
 
@@ -1209,7 +1197,7 @@ static errr process_pref_file_aux(cptr name, int preftype)
  * allow conditional evaluation and filename inclusion.
  * </pre>
  */
-errr process_pref_file(cptr name)
+errr process_pref_file(concptr name)
 {
        char buf[1024];
 
@@ -1472,11 +1460,8 @@ errr check_load_init(void)
                /* Use that value */
                check_load_value = value;
 
-               /* Done */
                break;
        }
-
-       /* Close the file */
        my_fclose(fp);
 
 #endif
@@ -1514,6 +1499,9 @@ errr check_load_init(void)
 #define ENTRY_SKILL_SEARCH 25
 #define ENTRY_SKILL_DISARM 26
 #define ENTRY_SKILL_DEVICE 27
+#define ENTRY_SKILL_DIG 45
+
+
 #define ENTRY_BLOWS 28
 #define ENTRY_SHOTS 29
 #define ENTRY_AVG_DMG 30
@@ -1589,6 +1577,7 @@ static struct
        {29,  7, 21, "属性"},
        {29, 14, 21, "強化度"},
        {29, 16, 21, "次レベル"},
+       {53, 19, -1, "掘削      :" },
 };
 #else
 = {
@@ -1637,6 +1626,7 @@ static struct
        {29,  7, 21, "Align"},
        {29, 14, 21, "Construction"},
        {29, 16, 21, "Const to Adv"},
+       {53, 19, -1, "Digging    :" },
 };
 #endif
 
@@ -1647,14 +1637,14 @@ static struct
  * @param attr 項目表示の色
  * @return なし
  */
-static void display_player_one_line(int entry, cptr val, byte attr)
+static void display_player_one_line(int entry, concptr val, TERM_COLOR attr)
 {
        char buf[40];
 
        int row = disp_player_line[entry].row;
        int col = disp_player_line[entry].col;
        int len = disp_player_line[entry].len;
-       cptr head = disp_player_line[entry].header;
+       concptr head = disp_player_line[entry].header;
 
        int head_len = strlen(head);
 
@@ -1686,8 +1676,8 @@ static void display_player_one_line(int entry, cptr val, byte attr)
 static void display_player_melee_bonus(int hand, int hand_entry)
 {
        char buf[160];
-       int show_tohit = p_ptr->dis_to_h[hand];
-       int show_todam = p_ptr->dis_to_d[hand];
+       HIT_PROB show_tohit = p_ptr->dis_to_h[hand];
+       HIT_POINT show_todam = p_ptr->dis_to_d[hand];
        object_type *o_ptr = &inventory[INVEN_RARM + hand];
 
        /* Hack -- add in weapon info if known */
@@ -1697,7 +1687,7 @@ static void display_player_melee_bonus(int hand, int hand_entry)
        show_tohit += p_ptr->skill_thn / BTH_PLUS_ADJ;
        
        /* Melee attacks */
-       sprintf(buf, "(%+d,%+d)", show_tohit, show_todam);
+       sprintf(buf, "(%+d,%+d)", (int)show_tohit, (int)show_todam);
 
        /* Dump the bonuses to hit/dam */
        if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
@@ -1719,8 +1709,8 @@ static void display_player_middle(void)
        char buf[160];
 
        /* Base skill */
-       int show_tohit = p_ptr->dis_to_h_b;
-       int show_todam = 0;
+       HIT_PROB show_tohit = p_ptr->dis_to_h_b;
+       HIT_POINT show_todam = 0;
 
        /* Range weapon */
        object_type *o_ptr = &inventory[INVEN_BOW];
@@ -1786,7 +1776,7 @@ static void display_player_middle(void)
        /* Dump speed */
        {
                int tmp_speed = 0;
-               byte attr;
+               TERM_COLOR attr;
                int i;
 
                i = p_ptr->pspeed-110;
@@ -1917,80 +1907,102 @@ static void display_player_middle(void)
 /*
  * Hack -- pass color info around this file
  */
-static byte likert_color = TERM_WHITE;
+static TERM_COLOR likert_color = TERM_WHITE;
 
 
 /*!
  * @brief 技能ランクの表示基準を定める
  * Returns a "rating" of x depending on y
  * @param x 技能値
- * @param y  技能値に対するランク基準比
+ * @param y 技能値に対するランク基準比
  * @return なし
  */
-static cptr likert(int x, int y)
+static concptr likert(int x, int y)
 {
-       static char dummy[20] = "";
+       static char dummy[20] = "", dummy2[20] = "";
+       memset(dummy, 0, strlen(dummy));
+       memset(dummy2, 0, strlen(dummy2));
 
        /* Paranoia */
        if (y <= 0) y = 1;
 
+       if(show_actual_value)
+       {
+               sprintf(dummy, "%3d-", x);
+       }
+
        /* Negative value */
        if (x < 0)
        {
                likert_color = TERM_L_DARK;
-               return _("最低", "Very Bad");
-       }
-
-       /* Analyze the value */
-       switch ((x / y))
-       {
-       case 0:
-       case 1:
-               likert_color = TERM_RED;
-               return _("悪い", "Bad");
-
-       case 2:
-               likert_color = TERM_L_RED;
-               return _("劣る", "Poor");
-
-       case 3:
-       case 4:
-               likert_color = TERM_ORANGE;
-               return _("普通", "Fair");
-
-       case 5:
-               likert_color = TERM_YELLOW;
-               return _("良い", "Good");
-
-       case 6:
-               likert_color = TERM_YELLOW;
-               return _("大変良い", "Very Good");
-
-       case 7:
-       case 8:
-               likert_color = TERM_L_GREEN;
-               return _("卓越", "Excellent");
-
-       case 9:
-       case 10:
-       case 11:
-       case 12:
-       case 13:
-               likert_color = TERM_GREEN;
-               return _("超越", "Superb");
-
-       case 14:
-       case 15:
-       case 16:
-       case 17:
-               likert_color = TERM_BLUE;
-               return _("英雄的", "Heroic");
+               strcat(dummy, _("最低", "Very Bad"));
+       }
+       else
+       {
 
-       default:
-               likert_color = TERM_VIOLET;
-               sprintf(dummy, _("伝説的[%d]", "Legendary[%d]"), (int)((((x / y) - 17) * 5) / 2));
-               return dummy;
+               /* Analyze the value */
+               switch ((x / y))
+               {
+               case 0:
+               case 1:
+                       likert_color = TERM_RED;
+                       strcat(dummy, _("悪い", "Bad"));
+                       break;
+               case 2:
+                       likert_color = TERM_L_RED;
+                       strcat(dummy, _("劣る", "Poor"));
+                       break;
+
+               case 3:
+               case 4:
+                       likert_color = TERM_ORANGE;
+                       strcat(dummy, _("普通", "Fair"));
+                       break;
+
+               case 5:
+                       likert_color = TERM_YELLOW;
+                       strcat(dummy, _("良い", "Good"));
+                       break;
+
+               case 6:
+                       likert_color = TERM_YELLOW;
+                       strcat(dummy, _("大変良い", "Very Good"));
+                       break;
+
+               case 7:
+               case 8:
+                       likert_color = TERM_L_GREEN;
+                       strcat(dummy, _("卓越", "Excellent"));
+                       break;
+
+               case 9:
+               case 10:
+               case 11:
+               case 12:
+               case 13:
+                       likert_color = TERM_GREEN;
+                       strcat(dummy, _("超越", "Superb"));
+                       break;
+
+               case 14:
+               case 15:
+               case 16:
+               case 17:
+                       likert_color = TERM_BLUE;
+                       strcat(dummy, _("英雄的", "Heroic"));
+                       break;
+
+               default:
+                       likert_color = TERM_VIOLET;
+                       sprintf(dummy2, _("伝説的[%d]", "Legendary[%d]"),
+                               (int)((((x / y) - 17) * 5) / 2));
+                       strcat(dummy, dummy2);
+
+                       break;
+               }
        }
+       return dummy;
+
 }
 
 
@@ -2006,9 +2018,10 @@ static void display_player_various(void)
        int         tmp, damage[2], to_h[2], blows1, blows2, i, basedam;
        int                     xthn, xthb, xfos, xsrh;
        int                     xdis, xdev, xsav, xstl;
-       cptr            desc;
+       int                     xdig;
+       concptr         desc;
        int         muta_att = 0;
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        int             shots, shot_frac;
        bool dokubari;
 
@@ -2030,7 +2043,7 @@ static void display_player_various(void)
        /* If the player is wielding one? */
        if (o_ptr->k_idx)
        {
-               s16b energy_fire = bow_energy(o_ptr->sval);
+               ENERGY energy_fire = bow_energy(o_ptr->sval);
 
                /* Calculate shots per round */
                shots = p_ptr->num_fire * 100;
@@ -2064,7 +2077,7 @@ static void display_player_various(void)
                damage[i] = p_ptr->dis_to_d[i] * 100;
                if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && (empty_hands(TRUE) & EMPTY_HAND_RARM))
                {
-                       int level = p_ptr->lev;
+                       PLAYER_LEVEL level = p_ptr->lev;
                        if (i)
                        {
                                damage[i] = 0;
@@ -2130,6 +2143,7 @@ static void display_player_various(void)
        xstl = p_ptr->skill_stl;
        xsrh = p_ptr->skill_srh;
        xfos = p_ptr->skill_fos;
+       xdig = p_ptr->skill_dig;
 
 
        desc = likert(xthn, 12);
@@ -2157,6 +2171,12 @@ static void display_player_various(void)
        desc = likert(xdev, 6);
        display_player_one_line(ENTRY_SKILL_DEVICE, desc, likert_color);
 
+       desc = likert(xdev, 6);
+       display_player_one_line(ENTRY_SKILL_DEVICE, desc, likert_color);
+
+       desc = likert(xdig, 4);
+       display_player_one_line(ENTRY_SKILL_DIG, desc, likert_color);
+
        if (!muta_att)
                display_player_one_line(ENTRY_BLOWS, format("%d+%d", blows1, blows2), TERM_L_BLUE);
        else
@@ -2187,7 +2207,7 @@ static void display_player_various(void)
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void player_flags(u32b flgs[TR_FLAG_SIZE])
+static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2634,7 +2654,7 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void tim_player_flags(u32b flgs[TR_FLAG_SIZE])
+static void tim_player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2765,11 +2785,11 @@ static void tim_player_flags(u32b flgs[TR_FLAG_SIZE])
  * @param mode オプション
  * @return なし
  */
-static void display_player_equippy(int y, int x, u16b mode)
+static void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 {
        int i, max_i;
 
-       byte a;
+       TERM_COLOR a;
        char c;
 
        object_type *o_ptr;
@@ -2816,7 +2836,7 @@ void print_equippy(void)
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void known_obj_immunity(u32b flgs[TR_FLAG_SIZE])
+static void known_obj_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2853,7 +2873,7 @@ static void known_obj_immunity(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void player_immunity(u32b flgs[TR_FLAG_SIZE])
+static void player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2878,7 +2898,7 @@ static void player_immunity(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void tim_player_immunity(u32b flgs[TR_FLAG_SIZE])
+static void tim_player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2905,7 +2925,7 @@ static void tim_player_immunity(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void player_vuln_flags(u32b flgs[TR_FLAG_SIZE])
+static void player_vuln_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2934,12 +2954,12 @@ static void player_vuln_flags(u32b flgs[TR_FLAG_SIZE])
  * A struct for storing misc. flags
  */
 typedef struct {
-       u32b player_flags[TR_FLAG_SIZE];
-       u32b tim_player_flags[TR_FLAG_SIZE];
-       u32b player_imm[TR_FLAG_SIZE];
-       u32b tim_player_imm[TR_FLAG_SIZE];
-       u32b player_vuln[TR_FLAG_SIZE];
-       u32b known_obj_imm[TR_FLAG_SIZE];
+       BIT_FLAGS player_flags[TR_FLAG_SIZE];
+       BIT_FLAGS tim_player_flags[TR_FLAG_SIZE];
+       BIT_FLAGS player_imm[TR_FLAG_SIZE];
+       BIT_FLAGS tim_player_imm[TR_FLAG_SIZE];
+       BIT_FLAGS player_vuln[TR_FLAG_SIZE];
+       BIT_FLAGS known_obj_imm[TR_FLAG_SIZE];
 } all_player_flags;
 
 
@@ -2954,7 +2974,7 @@ typedef struct {
  * @param mode 表示オプション
  * @return なし
  */
-static void display_flag_aux(int row, int col, cptr header,
+static void display_flag_aux(TERM_LEN row, TERM_LEN col, concptr header,
                                    int flag1, all_player_flags *f, u16b mode)
 {
        int     i;
@@ -2979,7 +2999,7 @@ static void display_flag_aux(int row, int col, cptr header,
        /* Check equipment */
        for (i = INVEN_RARM; i < max_i; i++)
        {
-               u32b flgs[TR_FLAG_SIZE];
+               BIT_FLAGS flgs[TR_FLAG_SIZE];
                object_type *o_ptr;
 
                /* Object */
@@ -3093,8 +3113,8 @@ static void display_flag_aux(int row, int col, cptr header,
  */
 static void display_player_flag_info(void)
 {
-       int row;
-       int col;
+       TERM_LEN row;
+       TERM_LEN col;
 
        all_player_flags f;
 
@@ -3115,20 +3135,20 @@ static void display_player_flag_info(void)
        c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+8);
 
 #ifdef JP
-display_flag_aux(row+0, col, "耐酸  :", TR_RES_ACID, &f, 0);
-display_flag_aux(row+0, col, "耐酸  :", TR_IM_ACID, &f, DP_IMM);
-display_flag_aux(row+1, col, "耐電撃:", TR_RES_ELEC, &f, 0);
-display_flag_aux(row+1, col, "耐電撃:", TR_IM_ELEC, &f, DP_IMM);
-display_flag_aux(row+2, col, "耐火炎:", TR_RES_FIRE, &f, 0);
-display_flag_aux(row+2, col, "耐火炎:", TR_IM_FIRE, &f, DP_IMM);
-display_flag_aux(row+3, col, "耐冷気:", TR_RES_COLD, &f, 0);
-display_flag_aux(row+3, col, "耐冷気:", TR_IM_COLD, &f, DP_IMM);
-display_flag_aux(row+4, col, "耐毒  :", TR_RES_POIS, &f, 0);
-display_flag_aux(row+5, col, "耐閃光:", TR_RES_LITE, &f, 0);
-display_flag_aux(row+6, col, "耐暗黒:", TR_RES_DARK, &f, 0);
-display_flag_aux(row+7, col, "耐破片:", TR_RES_SHARDS, &f, 0);
-display_flag_aux(row+8, col, "耐盲目:", TR_RES_BLIND, &f, 0);
-display_flag_aux(row+9, col, "耐混乱:", TR_RES_CONF, &f, 0);
+       display_flag_aux(row+0, col, "耐酸  :", TR_RES_ACID, &f, 0);
+       display_flag_aux(row+0, col, "耐酸  :", TR_IM_ACID, &f, DP_IMM);
+       display_flag_aux(row+1, col, "耐電撃:", TR_RES_ELEC, &f, 0);
+       display_flag_aux(row+1, col, "耐電撃:", TR_IM_ELEC, &f, DP_IMM);
+       display_flag_aux(row+2, col, "耐火炎:", TR_RES_FIRE, &f, 0);
+       display_flag_aux(row+2, col, "耐火炎:", TR_IM_FIRE, &f, DP_IMM);
+       display_flag_aux(row+3, col, "耐冷気:", TR_RES_COLD, &f, 0);
+       display_flag_aux(row+3, col, "耐冷気:", TR_IM_COLD, &f, DP_IMM);
+       display_flag_aux(row+4, col, "耐毒  :", TR_RES_POIS, &f, 0);
+       display_flag_aux(row+5, col, "耐閃光:", TR_RES_LITE, &f, 0);
+       display_flag_aux(row+6, col, "耐暗黒:", TR_RES_DARK, &f, 0);
+       display_flag_aux(row+7, col, "耐破片:", TR_RES_SHARDS, &f, 0);
+       display_flag_aux(row+8, col, "耐盲目:", TR_RES_BLIND, &f, 0);
+       display_flag_aux(row+9, col, "耐混乱:", TR_RES_CONF, &f, 0);
 #else
        display_flag_aux(row+0, col, "Acid  :", TR_RES_ACID, &f, 0);
        display_flag_aux(row+0, col, "Acid  :", TR_IM_ACID, &f, DP_IMM);
@@ -3157,16 +3177,16 @@ display_flag_aux(row+9, col, "耐混乱:", TR_RES_CONF, &f, 0);
        c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+8);
 
 #ifdef JP
-display_flag_aux(row+0, col, "耐轟音:", TR_RES_SOUND, &f, 0);
-display_flag_aux(row+1, col, "耐地獄:", TR_RES_NETHER, &f, 0);
-display_flag_aux(row+2, col, "耐因混:", TR_RES_NEXUS, &f, 0);
-display_flag_aux(row+3, col, "耐カオ:", TR_RES_CHAOS, &f, 0);
-display_flag_aux(row+4, col, "耐劣化:", TR_RES_DISEN, &f, 0);
-display_flag_aux(row+5, col, "耐恐怖:", TR_RES_FEAR, &f, 0);
-display_flag_aux(row+6, col, "反射  :", TR_REFLECT, &f, 0);
-display_flag_aux(row+7, col, "火炎オ:", TR_SH_FIRE, &f, 0);
-display_flag_aux(row+8, col, "電気オ:", TR_SH_ELEC, &f, 0);
-display_flag_aux(row+9, col, "冷気オ:", TR_SH_COLD, &f, 0);
+       display_flag_aux(row+0, col, "耐轟音:", TR_RES_SOUND, &f, 0);
+       display_flag_aux(row+1, col, "耐地獄:", TR_RES_NETHER, &f, 0);
+       display_flag_aux(row+2, col, "耐因混:", TR_RES_NEXUS, &f, 0);
+       display_flag_aux(row+3, col, "耐カオ:", TR_RES_CHAOS, &f, 0);
+       display_flag_aux(row+4, col, "耐劣化:", TR_RES_DISEN, &f, 0);
+       display_flag_aux(row+5, col, "耐恐怖:", TR_RES_FEAR, &f, 0);
+       display_flag_aux(row+6, col, "反射  :", TR_REFLECT, &f, 0);
+       display_flag_aux(row+7, col, "火炎オ:", TR_SH_FIRE, &f, 0);
+       display_flag_aux(row+8, col, "電気オ:", TR_SH_ELEC, &f, 0);
+       display_flag_aux(row+9, col, "冷気オ:", TR_SH_COLD, &f, 0);
 #else
        display_flag_aux(row+0, col, "Sound :", TR_RES_SOUND, &f, 0);
        display_flag_aux(row+1, col, "Nether:", TR_RES_NETHER, &f, 0);
@@ -3191,16 +3211,16 @@ display_flag_aux(row+9, col, "冷気オ:", TR_SH_COLD, &f, 0);
        c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+12);
 
 #ifdef JP
-display_flag_aux(row+0, col, "加速      :", TR_SPEED, &f, 0);
-display_flag_aux(row+1, col, "耐麻痺    :", TR_FREE_ACT, &f, 0);
-display_flag_aux(row+2, col, "透明体視認:", TR_SEE_INVIS, &f, 0);
-display_flag_aux(row+3, col, "経験値保持:", TR_HOLD_EXP, &f, 0);
-display_flag_aux(row+4, col, "警告      :", TR_WARNING, &f, 0);
-display_flag_aux(row+5, col, "遅消化    :", TR_SLOW_DIGEST, &f, 0);
-display_flag_aux(row+6, col, "急回復    :", TR_REGEN, &f, 0);
-display_flag_aux(row+7, col, "浮遊      :", TR_LEVITATION, &f, 0);
-display_flag_aux(row+8, col, "永遠光源  :", TR_LITE_1, &f, 0);
-display_flag_aux(row+9, col, "呪い      :", 0, &f, DP_CURSE);
+       display_flag_aux(row+0, col, "加速      :", TR_SPEED, &f, 0);
+       display_flag_aux(row+1, col, "耐麻痺    :", TR_FREE_ACT, &f, 0);
+       display_flag_aux(row+2, col, "透明体視認:", TR_SEE_INVIS, &f, 0);
+       display_flag_aux(row+3, col, "経験値保持:", TR_HOLD_EXP, &f, 0);
+       display_flag_aux(row+4, col, "警告      :", TR_WARNING, &f, 0);
+       display_flag_aux(row+5, col, "遅消化    :", TR_SLOW_DIGEST, &f, 0);
+       display_flag_aux(row+6, col, "急回復    :", TR_REGEN, &f, 0);
+       display_flag_aux(row+7, col, "浮遊      :", TR_LEVITATION, &f, 0);
+       display_flag_aux(row+8, col, "永遠光源  :", TR_LITE_1, &f, 0);
+       display_flag_aux(row+9, col, "呪い      :", 0, &f, DP_CURSE);
 #else
        display_flag_aux(row+0, col, "Speed     :", TR_SPEED, &f, 0);
        display_flag_aux(row+1, col, "FreeAction:", TR_FREE_ACT, &f, 0);
@@ -3224,8 +3244,8 @@ display_flag_aux(row+9, col, "呪い      :", 0, &f, DP_CURSE);
  */
 static void display_player_other_flag_info(void)
 {
-       int row;
-       int col;
+       TERM_LEN row;
+       TERM_LEN col;
 
        all_player_flags f;
 
@@ -3490,7 +3510,7 @@ static void display_player_stat_info(void)
        int row, col;
 
        object_type *o_ptr;
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        byte a;
        char c;
@@ -3505,23 +3525,14 @@ static void display_player_stat_info(void)
        row = 3;
 
        /* Print out the labels for the columns */
-#ifdef JP
-c_put_str(TERM_WHITE, "能力", row, stat_col+1);
-c_put_str(TERM_BLUE, "  基本", row, stat_col+7);
-c_put_str(TERM_L_BLUE, " 種 職 性 装 ", row, stat_col+13);
-c_put_str(TERM_L_GREEN, "合計", row, stat_col+28);
-c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
-#else
-       c_put_str(TERM_WHITE, "Stat", row, stat_col+1);
-       c_put_str(TERM_BLUE, "  Base", row, stat_col+7);
-       c_put_str(TERM_L_BLUE, "RacClaPerMod", row, stat_col+13);
-       c_put_str(TERM_L_GREEN, "Actual", row, stat_col+26);
-       c_put_str(TERM_YELLOW, "Current", row, stat_col+32);
-#endif
-
+       c_put_str(TERM_WHITE, _("能力", "Stat"), row, stat_col+1);
+       c_put_str(TERM_BLUE, _("  基本", "  Base"), row, stat_col+7);
+       c_put_str(TERM_L_BLUE, _(" 種 職 性 装 ", "RacClaPerMod"), row, stat_col+13);
+       c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col+28);
+       c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col+35);
 
        /* Display the stats */
-       for (i = 0; i < 6; i++)
+       for (i = 0; i < A_MAX; i++)
        {
                int r_adj;
 
@@ -3612,14 +3623,13 @@ c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
        /* Process equipment */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               /* Access object */
                o_ptr = &inventory[i];
 
                /* Acquire "known" flags */
                object_flags_known(o_ptr, flgs);
 
                /* Initialize color based of sign of pval. */
-               for (stat = 0; stat < 6; stat++)
+               for (stat = 0; stat < A_MAX; stat++)
                {
                        /* Default */
                        a = TERM_SLATE;
@@ -3678,7 +3688,7 @@ c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
        player_flags(flgs);
 
        /* Check stats */
-       for (stat = 0; stat < 6; stat++)
+       for (stat = 0; stat < A_MAX; stat++)
        {
                /* Default */
                a = TERM_SLATE;
@@ -3786,12 +3796,9 @@ c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
 void display_player(int mode)
 {
        int i;
+       char buf[80];
+       char tmp[64];
 
-       char    buf[80];
-       char    tmp[64];
-
-
-       /* XXX XXX XXX */
        if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && display_mutations)
                mode = (mode % 5);
        else
@@ -3844,7 +3851,7 @@ void display_player(int mode)
 
 
                /* Display the stats */
-               for (i = 0; i < 6; i++)
+               for (i = 0; i < A_MAX; i++)
                {
                        /* Special treatment of "injured" stats */
                        if (p_ptr->stat_cur[i] < p_ptr->stat_max[i])
@@ -4036,12 +4043,11 @@ void display_player(int mode)
  */
 static void dump_aux_display_player(FILE *fff)
 {
-       int x, y;
-       byte a;
+       TERM_LEN x, y;
+       TERM_COLOR a;
        char c;
-       char            buf[1024];
+       char buf[1024];
 
-       /* Display player */
        display_player(0);
 
        /* Dump part of the screen */
@@ -4169,7 +4175,7 @@ static void dump_aux_pet(FILE *fff)
        int i;
        bool pet = FALSE;
        bool pet_settings = FALSE;
-       char pet_name[80];
+       GAME_TEXT pet_name[MAX_NLEN];
 
        for (i = m_max - 1; i >= 1; i--)
        {
@@ -4230,7 +4236,7 @@ static void dump_aux_class_special(FILE *fff)
                int l2 = 0;
                int num = 0;
                int spellnum[MAX_MONSPELLS];
-               s32b f4 = 0, f5 = 0, f6 = 0;
+               BIT_FLAGS f4 = 0, f5 = 0, f6 = 0;
                char p[60][80];
                int col = 0;
                bool pcol = FALSE;
@@ -4329,9 +4335,9 @@ static void dump_aux_class_special(FILE *fff)
        else if (p_ptr->pclass == CLASS_MAGIC_EATER)
        {
                char s[EATER_EXT][MAX_NLEN];
-               OBJECT_TYPE_VALUE tval;
+               OBJECT_TYPE_VALUE tval = 0;
                int ext;
-               IDX k_idx;
+               KIND_OBJECT_IDX k_idx;
                OBJECT_SUBTYPE_VALUE i;
                int magic_num;
 
@@ -4409,9 +4415,9 @@ static void dump_aux_class_special(FILE *fff)
                for (i = 0; i < row; i++)
                {
                        fprintf(fff, "\n");
-                       fprintf(fff, "%-11s %5d     ", essence_name[id[i]], p_ptr->magic_num1[id[i]]);
-                       if(i + row < n) fprintf(fff, "%-11s %5d     ", essence_name[id[i + row]], p_ptr->magic_num1[id[i + row]]);
-                       if(i + row * 2 < n) fprintf(fff, "%-11s %5d", essence_name[id[i + row * 2]], p_ptr->magic_num1[id[i + row * 2]]);
+                       fprintf(fff, "%-11s %5d     ", essence_name[id[i]], (int)p_ptr->magic_num1[id[i]]);
+                       if(i + row < n) fprintf(fff, "%-11s %5d     ", essence_name[id[i + row]], (int)p_ptr->magic_num1[id[i + row]]);
+                       if(i + row * 2 < n) fprintf(fff, "%-11s %5d", essence_name[id[i + row * 2]], (int)p_ptr->magic_num1[id[i + row * 2]]);
                }
 
                fputs("\n", fff);
@@ -4434,13 +4440,13 @@ static void dump_aux_quest(FILE *fff)
        fprintf(fff, _("\n\n  [クエスト情報]\n", "\n\n  [Quest Information]\n"));
 
        /* Allocate Memory */
-       C_MAKE(quest_num, max_quests, IDX);
+       C_MAKE(quest_num, max_q_idx, IDX);
 
        /* Sort by compete level */
-       for (i = 1; i < max_quests; i++) quest_num[i] = i;
+       for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
        ang_sort_comp = ang_sort_comp_quest_num;
        ang_sort_swap = ang_sort_swap_quest_num;
-       ang_sort(quest_num, &dummy, max_quests);
+       ang_sort(quest_num, &dummy, max_q_idx);
 
        /* Dump Quest Information */
        fputc('\n', fff);
@@ -4450,7 +4456,7 @@ static void dump_aux_quest(FILE *fff)
        fputc('\n', fff);
 
        /* Free Memory */
-       C_KILL(quest_num, max_quests, IDX);
+       C_KILL(quest_num, max_q_idx, IDX);
 }
 
 
@@ -4800,7 +4806,7 @@ static void dump_aux_virtues(FILE *fff)
                else fprintf(fff, "Your current Life Rating is ???.\n\n");
                fprintf(fff, "Limits of maximum stats\n");
 #endif
-               for (v_nr = 0; v_nr < 6; v_nr++)
+               for (v_nr = 0; v_nr < A_MAX; v_nr++)
                {
                        if ((p_ptr->knowledge & KNOW_STAT) || p_ptr->stat_max[v_nr] == p_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], p_ptr->stat_max_max[v_nr]-18);
                        else fprintf(fff, "%s ???\n", stat_names[v_nr]);
@@ -4835,7 +4841,7 @@ static void dump_aux_mutations(FILE *fff)
 static void dump_aux_equipment_inventory(FILE *fff)
 {
        int i;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Dump the equipment */
        if (equip_cnt)
@@ -4878,7 +4884,7 @@ static void dump_aux_equipment_inventory(FILE *fff)
  */
 static void dump_aux_home_museum(FILE *fff)
 {
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        store_type  *st_ptr;
 
        /* Do we need it?? */
@@ -4891,7 +4897,7 @@ static void dump_aux_home_museum(FILE *fff)
        if (st_ptr->stock_num)
        {
                int i;
-               int x = 1;
+               TERM_LEN x = 1;
 
                fprintf(fff, _("  [我が家のアイテム]\n", "  [Home Inventory]\n"));
 
@@ -4916,7 +4922,7 @@ static void dump_aux_home_museum(FILE *fff)
        if (st_ptr->stock_num)
        {
                int i;
-               int x = 1;
+               TERM_LEN x = 1;
 
                fprintf(fff, _("  [博物館のアイテム]\n", "  [Museum]\n"));
 
@@ -4986,10 +4992,10 @@ errr make_character_dump(FILE *fff)
  * @param name 出力ファイル名
  * @return エラーコード
  * @details
- * XXX XXX XXX Allow the "full" flag to dump additional info,
+ * Allow the "full" flag to dump additional info,
  * and trigger its usage from various places in the code.
  */
-errr file_character(cptr name)
+errr file_character(concptr name)
 {
        int             fd = -1;
        FILE            *fff = NULL;
@@ -5008,8 +5014,6 @@ errr file_character(cptr name)
        if (fd >= 0)
        {
                char out_val[160];
-
-               /* Close the file */
                (void)fd_close(fd);
 
                /* Build query */
@@ -5025,7 +5029,6 @@ errr file_character(cptr name)
        /* Invalid file */
        if (!fff)
        {
-               /* Message */
                prt(_("キャラクタ情報のファイルへの書き出しに失敗しました!", "Character dump failed!"), 0, 0);
 
                (void)inkey();
@@ -5040,7 +5043,6 @@ errr file_character(cptr name)
        my_fclose(fff);
 
 
-       /* Message */
        msg_print(_("キャラクタ情報のファイルへの書き出しに成功しました。", "Character dump successful."));
        msg_print(NULL);
 
@@ -5065,7 +5067,7 @@ errr file_character(cptr name)
  * You can use any single character in place of the "|".
  * </pre>
  */
-static void show_file_aux_line(cptr str, int cy, cptr shower)
+static void show_file_aux_line(concptr str, int cy, concptr shower)
 {
        static const char tag_str[] = "[[[[";
        byte color = TERM_WHITE;
@@ -5090,7 +5092,7 @@ static void show_file_aux_line(cptr str, int cy, cptr shower)
                int showercol = len + 1;
                int bracketcol = len + 1;
                int endcol = len;
-               cptr ptr;
+               concptr ptr;
 
                /* Search for a shower string in the line */
                if (shower)
@@ -5194,7 +5196,7 @@ static void show_file_aux_line(cptr str, int cy, cptr shower)
  * Return FALSE on 'q' to exit from a deep, otherwise TRUE.
  * </pre>
  */
-bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
+bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAGS mode)
 {
        int i, n, skey;
 
@@ -5214,10 +5216,10 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
        FILE *fff = NULL;
 
        /* Find this string (if any) */
-       cptr find = NULL;
+       concptr find = NULL;
 
        /* Jump to this tag */
-       cptr tag = NULL;
+       concptr tag = NULL;
 
        /* Hold strings to find/show */
        char finder_str[81];
@@ -5225,7 +5227,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
        char back_str[81];
 
        /* String to show */
-       cptr shower = NULL;
+       concptr shower = NULL;
 
        /* Filename */
        char filename[1024];
@@ -5283,7 +5285,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
        /* Redirect the name */
        name = filename;
 
-       /* Hack XXX XXX XXX */
+       /* Hack */
        if (what)
        {
                /* Caption */
@@ -5339,14 +5341,11 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
                fff = my_fopen(path, "r");
        }
 
-       /* Oops */
        if (!fff)
        {
-               /* Message */
                msg_format(_("'%s'をオープンできません。", "Cannot open '%s'."), name);
                msg_print(NULL);
 
-               /* Oops */
                return (TRUE);
        }
 
@@ -5405,8 +5404,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
 
        /* start from bottom when reverse mode */
        if (line == -1) line = ((size-1)/rows)*rows;
-
-       /* Clear screen */
        Term_clear();
 
        /* Display the file */
@@ -5425,7 +5422,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
                        /* Hack -- Re-Open the file */
                        fff = my_fopen(path, "r");
 
-                       /* Oops */
                        if (!fff) return (FALSE);
 
                        /* File has been restarted */
@@ -5448,7 +5444,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
                /* Dump the next 20, or rows, lines of the file */
                for (i = 0; i < rows; )
                {
-                       cptr str = buf;
+                       concptr str = buf;
 
                        /* Hack -- track the "first" line */
                        if (!i) line = next;
@@ -5711,7 +5707,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
 
                        ffp = my_fopen(buff, "w");
 
-                       /* Oops */
                        if (!(fff && ffp))
                        {
                                msg_print(_("ファイルを開けません。", "Failed to open file."));
@@ -5743,8 +5738,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
                /* Exit on the q key */
                if (skey == 'q') break;
        }
-
-       /* Close the file */
        my_fclose(fff);
 
        /* Escape */
@@ -5763,13 +5756,10 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
  */
 void do_cmd_help(void)
 {
-       /* Save screen */
        screen_save();
 
        /* Peruse the main help file */
        (void)show_file(TRUE, _("jhelp.hlp", "help.hlp"), NULL, 0, 0);
-
-       /* Load screen */
        screen_load();
 }
 
@@ -5889,11 +5879,11 @@ void process_player_name(bool sf)
 #endif
        if (!savefile_base[0] && savefile[0])
        {
-               cptr s;
+               concptr s;
                s = savefile;
                while (1)
                {
-                       cptr t;
+                       concptr t;
                        t = my_strstr(s, PATH_SEP);
                        if (!t)
                                break;
@@ -5941,7 +5931,7 @@ void process_player_name(bool sf)
  * Assumes that "display_player(0)" has just been called
  * Perhaps we should NOT ask for a name (at "birth()") on
  * Unix machines?  XXX XXX
- * What a horrible name for a global function.  XXX XXX XXX
+ * What a horrible name for a global function.  
  * </pre>
  */
 void get_name(void)
@@ -6083,20 +6073,15 @@ void do_cmd_save_game(int is_autosave)
        }
        else
        {
-               /* Disturb the player */
-               disturb(1, 1);
+               disturb(TRUE, TRUE);
        }
 
        /* Clear messages */
        msg_print(NULL);
-
-       /* Handle stuff */
        handle_stuff();
 
-       /* Message */
        prt(_("ゲームをセーブしています...", "Saving game..."), 0, 0);
 
-       /* Refresh */
        Term_fresh();
 
        /* The player is not dead */
@@ -6120,23 +6105,21 @@ void do_cmd_save_game(int is_autosave)
        /* Allow suspend again */
        signals_handle_tstp();
 
-       /* Refresh */
        Term_fresh();
 
        /* Note that the player is not dead */
        (void)strcpy(p_ptr->died_from, _("(元気に生きている)", "(alive and well)"));
 
        /* HACK -- don't get sanity blast on updating view */
-       hack_mind = FALSE;
+       is_loading_now = FALSE;
 
-       /* Update stuff */
-       update_stuff();
+       update_creature(p_ptr);
 
        /* Initialize monster process */
        mproc_init();
 
        /* HACK -- reset the hackish flag */
-       hack_mind = TRUE;
+       is_loading_now = TRUE;
 }
 
 
@@ -6228,7 +6211,7 @@ long total_points(void)
  * @return なし
  * @details
  */
-static void center_string(char *buf, cptr str)
+static void center_string(char *buf, concptr str)
 {
        int i, j;
 
@@ -6269,7 +6252,7 @@ static void make_bones(void)
                {
                        char tmp[128];
 
-                       /* XXX XXX XXX "Bones" name */
+                       /* "Bones" name */
                        sprintf(tmp, "bone.%03d", dun_level);
 
                        /* Build the filename */
@@ -6338,7 +6321,7 @@ static void print_tomb(void)
        /* Print the text-tombstone */
        if (!done)
        {
-               cptr   p;
+               concptr   p;
                char   tmp[160];
                char   buf[1024];
                char   dummy[80];
@@ -6348,8 +6331,6 @@ static void print_tomb(void)
 #ifdef JP
                int    extra_line = 0;
 #endif
-
-               /* Clear screen */
                Term_clear();
 
                /* Build the filename */
@@ -6477,7 +6458,7 @@ static void print_tomb(void)
                {
                        if (dun_level == 0)
                        {
-                               cptr field_name = p_ptr->town_num ? "街" : "荒野";
+                               concptr field_name = p_ptr->town_num ? "街" : "荒野";
                                if (streq(p_ptr->died_from, "途中終了"))
                                {
                                        sprintf(tmp, "%sで死んだ", field_name);
@@ -6575,15 +6556,12 @@ static void show_info(void)
 
        /* Hack -- Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
 
        /* Flush all input keys */
        flush();
 
-       /* Flush messages */
-       msg_print(NULL);
+       msg_erase();
 
 
        /* Describe options */
@@ -6606,20 +6584,14 @@ static void show_info(void)
 
                /* Return means "show on screen" */
                if (!out_val[0]) break;
-
-               /* Save screen */
                screen_save();
 
                /* Dump a character file */
                (void)file_character(out_val);
-
-               /* Load screen */
                screen_load();
        }
 
        update_playtime();
-
-       /* Display player */
        display_player(0);
 
        /* Prompt for inventory */
@@ -6635,8 +6607,7 @@ static void show_info(void)
        if (equip_cnt)
        {
                Term_clear();
-               item_tester_full = TRUE;
-               (void)show_equip(0);
+               (void)show_equip(0, USE_FULL);
                prt(_("装備していたアイテム: -続く-", "You are using: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
@@ -6646,8 +6617,7 @@ static void show_info(void)
        if (inven_cnt)
        {
                Term_clear();
-               item_tester_full = TRUE;
-               (void)show_inven(0);
+               (void)show_inven(0, USE_FULL);
                prt(_("持っていたアイテム: -続く-", "You are carrying: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
@@ -6664,13 +6634,12 @@ static void show_info(void)
                        /* Display contents of the home */
                        for (k = 0, i = 0; i < st_ptr->stock_num; k++)
                        {
-                               /* Clear screen */
                                Term_clear();
 
                                /* Show 12 items */
                                for (j = 0; (j < 12) && (i < st_ptr->stock_num); j++, i++)
                                {
-                                       char o_name[MAX_NLEN];
+                                       GAME_TEXT o_name[MAX_NLEN];
                                        char tmp_val[80];
 
                                        /* Acquire item */
@@ -6702,7 +6671,6 @@ static void show_info(void)
  */
 static bool check_score(void)
 {
-       /* Clear screen */
        Term_clear();
 
        /* No score file */
@@ -6775,9 +6743,7 @@ void close_game(void)
        char buf[1024];
        bool do_send = TRUE;
 
-/*     cptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
-
-       /* Handle stuff */
+/*     concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
        handle_stuff();
 
        /* Flush the messages */
@@ -6827,8 +6793,6 @@ void close_game(void)
 
                /* Show more info */
                show_info();
-
-               /* Clear screen */
                Term_clear();
 
                if (check_score())
@@ -6862,7 +6826,7 @@ void close_game(void)
                /* Save the game */
                do_cmd_save_game(FALSE);
 
-               /* Prompt for scores XXX XXX XXX */
+               /* Prompt for scores */
                prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
                play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
 
@@ -6909,7 +6873,7 @@ void exit_game_panic(void)
        prt("", 0, 0);
 
        /* Hack -- turn off some things */
-       disturb(1, 1);
+       disturb(TRUE, TRUE);
 
        /* Mega-Hack -- Delay death */
        if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;
@@ -6943,7 +6907,7 @@ void exit_game_panic(void)
  * Based on the monster speech patch by Matt Graham,
  * </pre>
  */
-errr get_rnd_line(cptr file_name, int entry, char *output)
+errr get_rnd_line(concptr file_name, int entry, char *output)
 {
        FILE    *fp;
        char    buf[1024];
@@ -7035,8 +6999,6 @@ errr get_rnd_line(cptr file_name, int entry, char *output)
                /* Copy the line */
                if (one_in_(counter + 1)) strcpy(output, buf);
        }
-
-       /* Close the file */
        my_fclose(fp);
 
        /* Success */
@@ -7054,7 +7016,7 @@ errr get_rnd_line(cptr file_name, int entry, char *output)
  * @return エラーコード
  * @details
  */
-errr get_rnd_line_jonly(cptr file_name, int entry, char *output, int count)
+errr get_rnd_line_jonly(concptr file_name, int entry, char *output, int count)
 {
        int  i, j, kanji;
        errr result = 1;
@@ -7076,7 +7038,7 @@ errr get_rnd_line_jonly(cptr file_name, int entry, char *output, int count)
  * @param name ファイル名
  * @details
  */
-errr process_autopick_file(cptr name)
+errr process_autopick_file(concptr name)
 {
        char buf[1024];
 
@@ -7086,8 +7048,6 @@ errr process_autopick_file(cptr name)
        path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
 
        err = process_pref_file_aux(buf, PREF_TYPE_AUTOPICK);
-
-       /* Result */
        return (err);
 }
 
@@ -7099,7 +7059,7 @@ errr process_autopick_file(cptr name)
  * @return エラーコード
  * @details
  */
-errr process_histpref_file(cptr name)
+errr process_histpref_file(concptr name)
 {
        char buf[1024];
        errr err = 0;
@@ -7114,8 +7074,6 @@ errr process_histpref_file(cptr name)
        err = process_pref_file_aux(buf, PREF_TYPE_HISTPREF);
 
        character_xtra = old_character_xtra;
-
-       /* Result */
        return (err);
 }
 
@@ -7388,7 +7346,6 @@ static void handle_signal_simple(int sig)
                /* Display the cause */
                Term_putstr(0, 0, -1, TERM_WHITE, _("熟慮の上の自殺!", "Contemplating suicide!"));
 
-               /* Flush */
                Term_fresh();
        }
 
@@ -7447,7 +7404,6 @@ static void handle_signal_abort(int sig)
        _("恐ろしいソフトのバグが飛びかかってきた!", "A gruesome software bug LEAPS out at you!"));
 
 
-       /* Message */
        Term_putstr(45, hgt - 1, -1, TERM_RED, _("緊急セーブ...", "Panic save..."));
 
        do_cmd_write_nikki(NIKKI_GAMESTART, 0, _("----ゲーム異常終了----", "---- Panic Save and Abort Game ----"));