OSDN Git Service

[Refactor] #38844 player_uid を player_type 構造体に加える.
[hengband/hengband.git] / src / files.c
index 24f604b..1bce4f0 100644 (file)
 
 
 #include "angband.h"
+#include "util.h"
+#include "files.h"
+#include "core.h"
+
+#include "birth.h"
+#include "files.h"
+
+#include "bldg.h"
+
+#include "cmd-magiceat.h"
+#include "cmd-dump.h"
 #include "world.h"
+#include "player-race.h"
 #include "player-status.h"
+#include "player-move.h"
+#include "player-class.h"
+#include "player-skill.h"
+#include "player-personality.h"
+#include "player-sex.h"
+#include "player-effects.h"
+#include "sort.h"
+#include "mutation.h"
+#include "quest.h"
+#include "store.h"
+#include "artifact.h"
+#include "avatar.h"
+#include "shoot.h"
+#include "patron.h"
+#include "monster.h"
+#include "monster-process.h"
+#include "monster-status.h"
+#include "object-flavor.h"
+#include "object-hook.h"
+#include "realm.h"
+#include "realm-hex.h"
+#include "cmd-pet.h"
+#include "spells.h"
+#include "term.h"
+#include "view-mainwindow.h"
+#include "floor-events.h"
+#include "floor-town.h"
+#include "dungeon-file.h"
+#include "init.h"
+#include "monster-spell.h"
+#include "floor.h"
+#include "dungeon.h"
+#include "melee.h"
+#include "objectkind.h"
+#include "autopick.h"
+#include "save.h"
+#include "realm-song.h"
+
+concptr ANGBAND_DIR; //!< Path name: The main "lib" directory This variable is not actually used anywhere in the code
+concptr ANGBAND_DIR_APEX; //!< High score files (binary) These files may be portable between platforms
+concptr ANGBAND_DIR_BONE; //!< Bone files for player ghosts (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_DATA; //!< Binary image files for the "*_info" arrays (binary) These files are not portable between platforms
+concptr ANGBAND_DIR_EDIT; //!< Textual template files for the "*_info" arrays (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_SCRIPT; //!< Script files These files are portable between platforms.
+concptr ANGBAND_DIR_FILE; //!< Various extra files (ascii) These files may be portable between platforms
+concptr ANGBAND_DIR_HELP; //!< Help files (normal) for the online help (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
+concptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
+concptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
+concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
+
+s16b signal_count;             /* Hack -- Count interupts */
+
+/*
+ * Buffer to hold the current savefile name
+ * 'savefile' holds full path name. 'savefile_base' holds only base name.
+ */
+char savefile[1024];
+char savefile_base[40];
+
 
 
 /*
@@ -191,7 +264,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 */
 };
 
@@ -332,7 +405,7 @@ static named_num gf_desc[] =
  *   F:\<num\>:\<a\>:\<c\>
  * Specify the attr/char values for unaware "objects" by kind tval
  *   U:\<tv\>:\<a\>:\<c\>
- * Specify the attr/char values for inventory "objects" by kind tval
+ * Specify the attr/char values for p_ptr->inventory_list "objects" by kind tval
  *   E:\<tv\>:\<a\>:\<c\>
  * Define a macro action, given an encoded macro action
  *   A:\<str\>
@@ -496,7 +569,7 @@ errr process_pref_file_command(char *buf)
                        }
                        break;
 
-               /* Process "E:<tv>:<a>" -- attribute for inventory objects */
+               /* Process "E:<tv>:<a>" -- attribute for p_ptr->inventory_list objects */
                case 'E':
                        if (tokenize(buf+2, 2, zz, TOKENIZE_CHECKQUOTE) == 2)
                        {
@@ -557,8 +630,8 @@ errr process_pref_file_command(char *buf)
                        }
                        break;
 
-               /* Process "X:<str>" -- turn option off */
-               /* Process "Y:<str>" -- turn option on */
+               /* Process "X:<str>" -- current_world_ptr->game_turn option off */
+               /* Process "Y:<str>" -- current_world_ptr->game_turn option on */
                case 'X':
                case 'Y':
                        for (i = 0; option_info[i].o_desc; i++)
@@ -570,7 +643,7 @@ errr process_pref_file_command(char *buf)
                                        int os = option_info[i].o_set;
                                        int ob = option_info[i].o_bit;
 
-                                       if ((p_ptr->playing || character_xtra) &&
+                                       if ((p_ptr->playing || current_world_ptr->character_xtra) &&
                                                (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
                                        {
                                                msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
@@ -616,7 +689,7 @@ errr process_pref_file_command(char *buf)
                                if (streq(gf_desc[i].name, buf + 2))
                                {
                                        /* Remember this color set */
-                                       gf_color[gf_desc[i].num] = quark_add(t);
+                                       gf_color[gf_desc[i].num] = (TERM_COLOR)quark_add(t);
 
                                        /* Success */
                                        return 0;
@@ -756,9 +829,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;
@@ -784,8 +857,8 @@ cptr process_pref_file_expr(char **sp, char *fp)
        /* Analyze */
        if (*s == b1)
        {
-               cptr p;
-               cptr t;
+               concptr p;
+               concptr t;
 
                /* Skip b1 */
                s++;
@@ -1035,8 +1108,6 @@ cptr process_pref_file_expr(char **sp, char *fp)
 
        /* Save */
        (*fp) = f;
-
-       /* Save */
        (*sp) = s;
        return (v);
 }
@@ -1061,7 +1132,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;
 
@@ -1109,7 +1180,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 */
@@ -1198,7 +1269,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];
 
@@ -1330,8 +1401,6 @@ errr check_time_init(void)
                if (prefix(buf, "FRI:")) strcpy(days[5], buf);
                if (prefix(buf, "SAT:")) strcpy(days[6], buf);
        }
-
-       /* Close it */
        my_fclose(fp);
 
 #endif
@@ -1638,14 +1707,14 @@ static struct
  * @param attr 項目表示の色
  * @return なし
  */
-static void display_player_one_line(int entry, cptr val, TERM_COLOR 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);
 
@@ -1679,7 +1748,7 @@ static void display_player_melee_bonus(int hand, int hand_entry)
        char buf[160];
        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];
+       object_type *o_ptr = &p_ptr->inventory_list[INVEN_RARM + hand];
 
        /* Hack -- add in weapon info if known */
        if (object_is_known(o_ptr)) show_tohit += o_ptr->to_h;
@@ -1691,7 +1760,7 @@ static void display_player_melee_bonus(int hand, int hand_entry)
        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))
+       if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM))
                display_player_one_line(ENTRY_BARE_HAND, buf, TERM_L_BLUE);
        else if (p_ptr->ryoute)
                display_player_one_line(ENTRY_TWO_HANDS, buf, TERM_L_BLUE);
@@ -1714,7 +1783,7 @@ static void display_player_middle(void)
        HIT_POINT show_todam = 0;
 
        /* Range weapon */
-       object_type *o_ptr = &inventory[INVEN_BOW];
+       object_type *o_ptr = &p_ptr->inventory_list[INVEN_BOW];
 
        int tmul = 0;
        int e;
@@ -1758,9 +1827,9 @@ static void display_player_middle(void)
        /* Range attacks */
        display_player_one_line(ENTRY_SHOOT_HIT_DAM, format("(%+d,%+d)", show_tohit, show_todam), TERM_L_BLUE);
 
-       if (inventory[INVEN_BOW].k_idx)
+       if (p_ptr->inventory_list[INVEN_BOW].k_idx)
        {
-               tmul = bow_tmul(inventory[INVEN_BOW].sval);
+               tmul = bow_tmul(p_ptr->inventory_list[INVEN_BOW].sval);
 
                /* Get extra "power" from "extra might" */
                if (p_ptr->xtra_might) tmul++;
@@ -1815,8 +1884,8 @@ static void display_player_middle(void)
                }
                else
                {
-                       if (MON_FAST(&m_list[p_ptr->riding])) tmp_speed += 10;
-                       if (MON_SLOW(&m_list[p_ptr->riding])) tmp_speed -= 10;
+                       if (MON_FAST(&current_floor_ptr->m_list[p_ptr->riding])) tmp_speed += 10;
+                       if (MON_SLOW(&current_floor_ptr->m_list[p_ptr->riding])) tmp_speed -= 10;
                }
 
                if (tmp_speed)
@@ -1901,7 +1970,7 @@ static void display_player_middle(void)
                display_player_one_line(ENTRY_SP, format("%4d/%4d", p_ptr->csp , p_ptr->msp), TERM_RED);
 
        /* Dump play time */
-       display_player_one_line(ENTRY_PLAY_TIME, format("%.2lu:%.2lu:%.2lu", playtime/(60*60), (playtime/60)%60, playtime%60), TERM_L_GREEN);
+       display_player_one_line(ENTRY_PLAY_TIME, format("%.2lu:%.2lu:%.2lu", current_world_ptr->play_time/(60*60), (current_world_ptr->play_time/60)%60, current_world_ptr->play_time%60), TERM_L_GREEN);
 }
 
 
@@ -1918,13 +1987,11 @@ static TERM_COLOR likert_color = TERM_WHITE;
  * @param y 技能値に対するランク基準比
  * @return なし
  */
-static cptr likert(int x, int y)
+static concptr likert(int x, int y)
 {
        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)
@@ -2020,13 +2087,13 @@ static void display_player_various(void)
        int                     xthn, xthb, xfos, xsrh;
        int                     xdis, xdev, xsav, xstl;
        int                     xdig;
-       cptr            desc;
+       concptr         desc;
        int         muta_att = 0;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
        int             shots, shot_frac;
        bool dokubari;
 
-       object_type             *o_ptr;
+       object_type *o_ptr;
 
        if (p_ptr->muta2 & MUT2_HORNS)     muta_att++;
        if (p_ptr->muta2 & MUT2_SCOR_TAIL) muta_att++;
@@ -2037,7 +2104,7 @@ static void display_player_various(void)
        xthn = p_ptr->skill_thn + (p_ptr->to_h_m * BTH_PLUS_ADJ);
 
        /* Shooting Skill (with current bow and normal missile) */
-       o_ptr = &inventory[INVEN_BOW];
+       o_ptr = &p_ptr->inventory_list[INVEN_BOW];
        tmp = p_ptr->to_h_b + o_ptr->to_h;
        xthb = p_ptr->skill_thb + (tmp * BTH_PLUS_ADJ);
 
@@ -2094,7 +2161,7 @@ static void display_player_various(void)
                }
                else
                {
-                       o_ptr = &inventory[INVEN_RARM + i];
+                       o_ptr = &p_ptr->inventory_list[INVEN_RARM + i];
 
                        /* Average damage per round */
                        if (o_ptr->k_idx)
@@ -2248,8 +2315,8 @@ static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
                        add_flag(flgs, TR_SPEED);
                else
                {
-                       if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
-                           (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
+                       if ((!p_ptr->inventory_list[INVEN_RARM].k_idx || p_ptr->migite) &&
+                           (!p_ptr->inventory_list[INVEN_LARM].k_idx || p_ptr->hidarite))
                                add_flag(flgs, TR_SPEED);
                        if (p_ptr->lev>24)
                                add_flag(flgs, TR_FREE_ACT);
@@ -2586,6 +2653,8 @@ static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 
        if (p_ptr->pseikaku == SEIKAKU_SEXY)
                add_flag(flgs, TR_AGGRAVATE);
+       if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN)
+               add_flag(flgs, TR_RES_CONF);
        if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
        {
                add_flag(flgs, TR_RES_BLIND);
@@ -2674,7 +2743,7 @@ static void tim_player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
        if (IS_FAST() || p_ptr->slow)
                add_flag(flgs, TR_SPEED);
 
-       if (IS_OPPOSE_ACID() && !(p_ptr->special_defense & DEFENSE_ACID) && !(prace_is_(RACE_YEEK) && (p_ptr->lev > 19)))
+       if (IS_OPPOSE_ACID() && !(p_ptr->special_defense & DEFENSE_ACID) && !(PRACE_IS_(RACE_YEEK) && (p_ptr->lev > 19)))
                add_flag(flgs, TR_RES_ACID);
        if (IS_OPPOSE_ELEC() && !(p_ptr->special_defense & DEFENSE_ELEC))
                add_flag(flgs, TR_RES_ELEC);
@@ -2786,7 +2855,7 @@ static void tim_player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
  * @param mode オプション
  * @return なし
  */
-static void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
+void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 {
        int i, max_i;
 
@@ -2803,7 +2872,7 @@ static void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
        for (i = INVEN_RARM; i < max_i; i++)
        {
                /* Object */
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                a = object_attr(o_ptr);
                c = object_char(o_ptr);
@@ -2822,15 +2891,6 @@ static void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 
 
 /*!
- * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
- * @return なし
- */
-void print_equippy(void)
-{
-       display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
-}
-
-/*!
  * @brief プレイヤーの装備による免疫フラグを返す
  * @param flgs フラグを保管する配列
  * @return なし
@@ -2853,7 +2913,7 @@ static void known_obj_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
                object_type *o_ptr;
 
                /* Object */
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                if (!o_ptr->k_idx) continue;
 
@@ -2882,13 +2942,13 @@ static void player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
-       if (prace_is_(RACE_SPECTRE))
+       if (PRACE_IS_(RACE_SPECTRE))
                add_flag(flgs, TR_RES_NETHER);
-       if (p_ptr->mimic_form == MIMIC_VAMPIRE || prace_is_(RACE_VAMPIRE))
+       if (p_ptr->mimic_form == MIMIC_VAMPIRE || PRACE_IS_(RACE_VAMPIRE))
                add_flag(flgs, TR_RES_DARK);
        if (p_ptr->mimic_form == MIMIC_DEMON_LORD)
                add_flag(flgs, TR_RES_FIRE);
-       else if (prace_is_(RACE_YEEK) && p_ptr->lev > 19)
+       else if (PRACE_IS_(RACE_YEEK) && p_ptr->lev > 19)
                add_flag(flgs, TR_RES_ACID);
 }
 
@@ -2941,11 +3001,11 @@ static void player_vuln_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
                add_flag(flgs, TR_RES_FIRE);
                add_flag(flgs, TR_RES_COLD);
        }
-       if (prace_is_(RACE_ANDROID))
+       if (PRACE_IS_(RACE_ANDROID))
                add_flag(flgs, TR_RES_ELEC);
-       if (prace_is_(RACE_ENT))
+       if (PRACE_IS_(RACE_ENT))
                add_flag(flgs, TR_RES_FIRE);
-       if (prace_is_(RACE_VAMPIRE) || prace_is_(RACE_S_FAIRY) ||
+       if (PRACE_IS_(RACE_VAMPIRE) || PRACE_IS_(RACE_S_FAIRY) ||
            (p_ptr->mimic_form == MIMIC_VAMPIRE))
                add_flag(flgs, TR_RES_LITE);
 }
@@ -2975,7 +3035,7 @@ typedef struct {
  * @param mode 表示オプション
  * @return なし
  */
-static void display_flag_aux(TERM_LEN row, TERM_LEN 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;
@@ -3004,7 +3064,7 @@ static void display_flag_aux(TERM_LEN row, TERM_LEN col, cptr header,
                object_type *o_ptr;
 
                /* Object */
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Known flags */
                object_flags_known(o_ptr, flgs);
@@ -3034,12 +3094,12 @@ static void display_flag_aux(TERM_LEN row, TERM_LEN col, cptr header,
                }
                else if (flag1 == TR_LITE_1)
                {
-                       if (have_dark_flag(flgs))
+                       if (HAVE_DARK_FLAG(flgs))
                        {
                                c_put_str(TERM_L_DARK, "+", row, col);
                                header_color = TERM_WHITE;
                        }
-                       else if (have_lite_flag(flgs))
+                       else if (HAVE_LITE_FLAG(flgs))
                        {
                                c_put_str(TERM_WHITE, "+", row, col);
                                header_color = TERM_WHITE;
@@ -3526,23 +3586,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;
 
@@ -3563,7 +3614,7 @@ c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
                if ((p_ptr->stat_max[i] > 18) && (p_ptr->stat_top[i] <= 18))
                        e_adj = p_ptr->stat_top[i] - (p_ptr->stat_max[i] - 19) / 10 - 19;
 
-               if (prace_is_(RACE_ENT))
+               if (PRACE_IS_(RACE_ENT))
                {
                        switch (i)
                        {
@@ -3633,14 +3684,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];
+               o_ptr = &p_ptr->inventory_list[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;
@@ -3699,7 +3749,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;
@@ -3862,7 +3912,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])
@@ -3933,7 +3983,7 @@ void display_player(int mode)
                                        sprintf(statmsg, "...You %s after the winning.", streq(p_ptr->died_from, "Seppuku") ? "did Seppuku" : "retired from the adventure");
 #endif
                                }
-                               else if (!dun_level)
+                               else if (!current_floor_ptr->dun_level)
                                {
 #ifdef JP
                                        sprintf(statmsg, "…あなたは%sで%sに殺された。", map_name(), p_ptr->died_from);
@@ -3958,15 +4008,15 @@ void display_player(int mode)
                                else
                                {
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)dun_level, p_ptr->died_from);
+                                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)current_floor_ptr->dun_level, p_ptr->died_from);
 #else
-                                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", p_ptr->died_from, dun_level, map_name());
+                                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", p_ptr->died_from, current_floor_ptr->dun_level, map_name());
 #endif
                                }
                        }
-                       else if (character_dungeon)
+                       else if (current_world_ptr->character_dungeon)
                        {
-                               if (!dun_level)
+                               if (!current_floor_ptr->dun_level)
                                {
                                        sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name());
                                }
@@ -3990,9 +4040,9 @@ void display_player(int mode)
                                else
                                {
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(), (int)dun_level);
+                                       sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(), (int)current_floor_ptr->dun_level);
 #else
-                                       sprintf(statmsg, "...Now, you are exploring level %d of %s.", dun_level, map_name());
+                                       sprintf(statmsg, "...Now, you are exploring level %d of %s.", current_floor_ptr->dun_level, map_name());
 #endif
                                }
                        }
@@ -4188,11 +4238,11 @@ static void dump_aux_pet(FILE *fff)
        bool pet_settings = FALSE;
        GAME_TEXT pet_name[MAX_NLEN];
 
-       for (i = m_max - 1; i >= 1; i--)
+       for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
                if (!is_pet(m_ptr)) continue;
                pet_settings = TRUE;
                if (!m_ptr->nickname && (p_ptr->riding != i)) continue;
@@ -4444,20 +4494,18 @@ static void dump_aux_class_special(FILE *fff)
  */
 static void dump_aux_quest(FILE *fff)
 {
-       IDX i;
-       IDX *quest_num;
+       QUEST_IDX i;
+       QUEST_IDX *quest_num;
        int dummy;
 
        fprintf(fff, _("\n\n  [クエスト情報]\n", "\n\n  [Quest Information]\n"));
 
        /* Allocate Memory */
-       C_MAKE(quest_num, max_q_idx, IDX);
+       C_MAKE(quest_num, max_q_idx, QUEST_IDX);
 
        /* Sort by compete level */
        for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
-       ang_sort_comp = ang_sort_comp_quest_num;
-       ang_sort_swap = ang_sort_swap_quest_num;
-       ang_sort(quest_num, &dummy, max_q_idx);
+       ang_sort(quest_num, &dummy, max_q_idx, ang_sort_comp_quest_num, ang_sort_swap_quest_num);
 
        /* Dump Quest Information */
        fputc('\n', fff);
@@ -4467,7 +4515,7 @@ static void dump_aux_quest(FILE *fff)
        fputc('\n', fff);
 
        /* Free Memory */
-       C_KILL(quest_num, max_q_idx, IDX);
+       C_KILL(quest_num, max_q_idx, QUEST_IDX);
 }
 
 
@@ -4650,7 +4698,7 @@ static void dump_aux_monsters(FILE *fff)
        IDX k;
        long uniq_total = 0;
        long norm_total = 0;
-       IDX *who;
+       MONRACE_IDX *who;
 
        /* Sort by monster level */
        u16b why = 2;
@@ -4658,7 +4706,7 @@ static void dump_aux_monsters(FILE *fff)
        fprintf(fff, _("\n  [倒したモンスター]\n\n", "\n  [Defeated Monsters]\n\n"));
 
        /* Allocate the "who" array */
-       C_MAKE(who, max_r_idx, s16b);
+       C_MAKE(who, max_r_idx, MONRACE_IDX);
 
        /* Count monster kills */
        for (k = 1; k < max_r_idx; k++)
@@ -4668,7 +4716,6 @@ static void dump_aux_monsters(FILE *fff)
                /* Ignore unused index */
                if (!r_ptr->name) continue;
 
-               /* Unique monsters */
                if (r_ptr->flags1 & RF1_UNIQUE)
                {
                        bool dead = (r_ptr->max_num == 0);
@@ -4680,8 +4727,6 @@ static void dump_aux_monsters(FILE *fff)
                                who[uniq_total++] = k;
                        }
                }
-
-               /* Normal monsters */
                else
                {
                        if (r_ptr->r_pkills > 0)
@@ -4717,13 +4762,8 @@ static void dump_aux_monsters(FILE *fff)
                fprintf(fff, "You have defeated %ld %s including %ld unique monster%s in total.\n", norm_total, norm_total == 1 ? "enemy" : "enemies", uniq_total, (uniq_total == 1 ? "" : "s"));
 #endif
 
-
-               /* Select the sort method */
-               ang_sort_comp = ang_sort_comp_hook;
-               ang_sort_swap = ang_sort_swap_hook;
-
                /* Sort the array by dungeon depth of monsters */
-               ang_sort(who, &why, uniq_total);
+               ang_sort(who, &why, uniq_total, ang_sort_comp_hook, ang_sort_swap_hook);
                fprintf(fff, _("\n《上位%ld体のユニーク・モンスター》\n", "\n< Unique monsters top %ld >\n"), MIN(uniq_total, 10));
 
                /* Print top 10 */
@@ -4817,7 +4857,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]);
@@ -4855,12 +4895,12 @@ static void dump_aux_equipment_inventory(FILE *fff)
        GAME_TEXT o_name[MAX_NLEN];
 
        /* Dump the equipment */
-       if (equip_cnt)
+       if (p_ptr->equip_cnt)
        {
                fprintf(fff, _("  [キャラクタの装備]\n\n", "  [Character Equipment]\n\n"));
                for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
                {
-                       object_desc(o_name, &inventory[i], 0);
+                       object_desc(o_name, &p_ptr->inventory_list[i], 0);
                        if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
                                strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
 
@@ -4870,16 +4910,16 @@ static void dump_aux_equipment_inventory(FILE *fff)
                fprintf(fff, "\n\n");
        }
 
-       /* Dump the inventory */
+       /* Dump the p_ptr->inventory_list */
        fprintf(fff, _("  [キャラクタの持ち物]\n\n", "  [Character Inventory]\n\n"));
 
        for (i = 0; i < INVEN_PACK; i++)
        {
                /* Don't dump the empty slots */
-               if (!inventory[i].k_idx) break;
+               if (!p_ptr->inventory_list[i].k_idx) break;
 
-               /* Dump the inventory slots */
-               object_desc(o_name, &inventory[i], 0);
+               /* Dump the p_ptr->inventory_list slots */
+               object_desc(o_name, &p_ptr->inventory_list[i], 0);
                fprintf(fff, "%c) %s\n", index_to_label(i), o_name);
        }
 
@@ -4899,10 +4939,10 @@ static void dump_aux_home_museum(FILE *fff)
        store_type  *st_ptr;
 
        /* Do we need it?? */
-       /* process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x); */
+       /* process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); */
 
        /* Print the home */
-       st_ptr = &town[1].store[STORE_HOME];
+       st_ptr = &town_info[1].store[STORE_HOME];
 
        /* Home -- if anything there */
        if (st_ptr->stock_num)
@@ -4927,7 +4967,7 @@ static void dump_aux_home_museum(FILE *fff)
 
 
        /* Print the home */
-       st_ptr = &town[1].store[STORE_MUSEUM];
+       st_ptr = &town_info[1].store[STORE_MUSEUM];
 
        /* Home -- if anything there */
        if (st_ptr->stock_num)
@@ -5006,7 +5046,7 @@ errr make_character_dump(FILE *fff)
  * 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;
@@ -5049,8 +5089,6 @@ errr file_character(cptr name)
        }
 
        (void)make_character_dump(fff);
-
-       /* Close it */
        my_fclose(fff);
 
 
@@ -5078,7 +5116,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;
@@ -5103,7 +5141,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)
@@ -5207,7 +5245,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, BIT_FLAGS mode)
+bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAGS mode)
 {
        int i, n, skey;
 
@@ -5227,10 +5265,10 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS 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];
@@ -5238,7 +5276,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
        char back_str[81];
 
        /* String to show */
-       cptr shower = NULL;
+       concptr shower = NULL;
 
        /* Filename */
        char filename[1024];
@@ -5427,7 +5465,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
                /* Re-open the file if needed */
                if (next > line)
                {
-                       /* Close it */
                        my_fclose(fff);
 
                        /* Hack -- Re-Open the file */
@@ -5455,7 +5492,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS 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;
@@ -5706,8 +5743,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
                        strcpy (xtmp, "");
 
                        if (!get_string(_("ファイル名: ", "File name: "), xtmp, 80)) continue;
-
-                       /* Close it */
                        my_fclose(fff);
 
                        /* Build the filename */
@@ -5731,8 +5766,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
 
                        while (!my_fgets(fff, buff, sizeof(buff)))
                                my_fputs(ffp, buff, 80);
-
-                       /* Close it */
                        my_fclose(fff);
                        my_fclose(ffp);
 
@@ -5789,7 +5822,7 @@ void process_player_name(bool sf)
        int i, k = 0;
        char old_player_base[32] = "";
 
-       if (character_generated) strcpy(old_player_base, player_base);
+       if (current_world_ptr->character_generated) strcpy(old_player_base, p_ptr->base_name);
 
        /* Cannot be too long */
 #if defined(MACINTOSH) || defined(ACORN)
@@ -5834,7 +5867,7 @@ void process_player_name(bool sf)
                if (c == '.') c = '_';
 
                /* Accept all the letters */
-               player_base[k++] = c;
+               p_ptr->base_name[k++] = c;
        }
 
 #else
@@ -5851,35 +5884,35 @@ void process_player_name(bool sf)
                /* Accept some letters */
 #ifdef JP
                if(iskanji(c)){
-                 if(k + 2 >= sizeof(player_base) || !p_ptr->name[i+1]) break;
-                 player_base[k++] = c;
+                 if(k + 2 >= sizeof(p_ptr->base_name) || !p_ptr->name[i+1]) break;
+                 p_ptr->base_name[k++] = c;
                  i++;
-                 player_base[k++] = p_ptr->name[i];
+                 p_ptr->base_name[k++] = p_ptr->name[i];
                }
 #ifdef SJIS
-               else if (iskana(c)) player_base[k++] = c;
+               else if (iskana(c)) p_ptr->base_name[k++] = c;
 #endif
                else
 #endif
                /* Convert path separator to underscore */
                if (!strncmp(PATH_SEP, p_ptr->name+i, strlen(PATH_SEP))){
-                       player_base[k++] = '_';
+                       p_ptr->base_name[k++] = '_';
                        i += strlen(PATH_SEP);
                }
                /* Convert some characters to underscore */
 #if defined(WINDOWS)
-               else if (my_strchr("\"*,/:;<>?\\|", c)) player_base[k++] = '_';
+               else if (my_strchr("\"*,/:;<>?\\|", c)) p_ptr->base_name[k++] = '_';
 #endif
-               else if (isprint(c)) player_base[k++] = c;
+               else if (isprint(c)) p_ptr->base_name[k++] = c;
        }
 
 #endif
 
        /* Terminate */
-       player_base[k] = '\0';
+       p_ptr->base_name[k] = '\0';
 
        /* Require a "base" name */
-       if (!player_base[0]) strcpy(player_base, "PLAYER");
+       if (!p_ptr->base_name[0]) strcpy(p_ptr->base_name, "PLAYER");
 
 
 #ifdef SAVEFILE_MUTABLE
@@ -5890,11 +5923,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;
@@ -5911,14 +5944,14 @@ void process_player_name(bool sf)
        {
                char temp[128];
 
-               strcpy(savefile_base, player_base);
+               strcpy(savefile_base, p_ptr->base_name);
 
 #ifdef SAVEFILE_USE_UID
-               /* Rename the savefile, using the player_uid and player_base */
-               (void)sprintf(temp, "%d.%s", player_uid, player_base);
+               /* Rename the savefile, using the p_ptr->player_uid and p_ptr->base_name */
+               (void)sprintf(temp, "%d.%s", p_ptr->player_uid, p_ptr->base_name);
 #else
-               /* Rename the savefile, using the player_base */
-               (void)sprintf(temp, "%s", player_base);
+               /* Rename the savefile, using the p_ptr->base_name */
+               (void)sprintf(temp, "%s", p_ptr->base_name);
 #endif
 
                /* Build the filename */
@@ -5926,9 +5959,9 @@ void process_player_name(bool sf)
        }
 
        /* Load an autopick preference file */
-       if (character_generated)
+       if (current_world_ptr->character_generated)
        {
-               if (!streq(old_player_base, player_base)) autopick_load_pref(FALSE);
+               if (!streq(old_player_base, p_ptr->base_name)) autopick_load_pref(FALSE);
        }
 }
 
@@ -5985,90 +6018,6 @@ void get_name(void)
 
 
 /*!
- * @brief 自殺するコマンドのメインルーチン
- * Hack -- commit suicide
- * @return なし
- * @details
- */
-void do_cmd_suicide(void)
-{
-       int i;
-
-       /* Flush input */
-       flush();
-
-       /* Verify Retirement */
-       if (p_ptr->total_winner)
-       {
-               /* Verify */
-               if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
-       }
-
-       /* Verify Suicide */
-       else
-       {
-               /* Verify */
-               if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
-       }
-
-
-       if (!p_ptr->noscore)
-       {
-               /* Special Verification for suicide */
-               prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
-
-               flush();
-               i = inkey();
-               prt("", 0, 0);
-               if (i != '@') return;
-
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
-       }
-
-       /* Initialize "last message" buffer */
-       if (p_ptr->last_message) string_free(p_ptr->last_message);
-       p_ptr->last_message = NULL;
-
-       /* Hack -- Note *winning* message */
-       if (p_ptr->total_winner && last_words)
-       {
-               char buf[1024] = "";
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
-               do
-               {
-                       while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf)) ;
-               }
-               while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
-
-               if (buf[0])
-               {
-                       p_ptr->last_message = string_make(buf);
-                       msg_print(p_ptr->last_message);
-               }
-       }
-
-       /* Stop playing */
-       p_ptr->playing = FALSE;
-
-       /* Kill the player */
-       p_ptr->is_dead = TRUE;
-
-       /* Leaving */
-       p_ptr->leaving = TRUE;
-
-       if (!p_ptr->total_winner)
-       {
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide."));
-               do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
-       }
-
-       /* Cause of death */
-       (void)strcpy(p_ptr->died_from, _("途中終了", "Quitting"));
-}
-
-
-/*!
  * @brief セーブするコマンドのメインルーチン
  * Save the game
  * @param is_autosave オートセーブ中の処理ならばTRUE
@@ -6122,7 +6071,7 @@ void do_cmd_save_game(int is_autosave)
        (void)strcpy(p_ptr->died_from, _("(元気に生きている)", "(alive and well)"));
 
        /* HACK -- don't get sanity blast on updating view */
-       is_loading_now = FALSE;
+       current_world_ptr->is_loading_now = FALSE;
 
        update_creature(p_ptr);
 
@@ -6130,7 +6079,7 @@ void do_cmd_save_game(int is_autosave)
        mproc_init();
 
        /* HACK -- reset the hackish flag */
-       is_loading_now = TRUE;
+       current_world_ptr->is_loading_now = TRUE;
 }
 
 
@@ -6143,77 +6092,11 @@ void do_cmd_save_game(int is_autosave)
 void do_cmd_save_and_exit(void)
 {
        p_ptr->playing = FALSE;
-
-       /* Leaving */
        p_ptr->leaving = TRUE;
        do_cmd_write_nikki(NIKKI_GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
 }
 
 
-/*!
- * @brief スコアを計算する /
- * Hack -- Calculates the total number of points earned                -JWT-
- * @return なし
- * @details
- */
-long total_points(void)
-{
-       int i, mult = 100;
-       DEPTH max_dl = 0;
-       u32b point, point_h, point_l;
-       int arena_win = MIN(p_ptr->arena_number, MAX_ARENA_MONS);
-
-       if (!preserve_mode) mult += 10;
-       if (!autoroller) mult += 10;
-       if (!smart_learn) mult -= 20;
-       if (smart_cheat) mult += 30;
-       if (ironman_shops) mult += 50;
-       if (ironman_small_levels) mult += 10;
-       if (ironman_empty_levels) mult += 20;
-       if (!powerup_home) mult += 50;
-       if (ironman_rooms) mult += 100;
-       if (ironman_nightmare) mult += 100;
-
-       if (mult < 5) mult = 5;
-
-       for (i = 0; i < max_d_idx; i++)
-               if(max_dlv[i] > max_dl)
-                       max_dl = max_dlv[i];
-
-       point_l = (p_ptr->max_max_exp + (100 * max_dl));
-       point_h = point_l / 0x10000L;
-       point_l = point_l % 0x10000L;
-       point_h *= mult;
-       point_l *= mult;
-       point_h += point_l / 0x10000L;
-       point_l %= 0x10000L;
-
-       point_l += ((point_h % 100) << 16);
-       point_h /= 100;
-       point_l /= 100;
-
-       point = (point_h << 16) + (point_l);
-       if (p_ptr->arena_number >= 0)
-               point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
-
-       if (ironman_downward) point *= 2;
-       if (p_ptr->pclass == CLASS_BERSERKER)
-       {
-               if ( p_ptr->prace == RACE_SPECTRE )
-                       point = point / 5;
-       }
-
-       if ((p_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
-       {
-               point = 1;
-               if (p_ptr->total_winner) point = 2;
-       }
-       if (easy_band) point = (0 - point);
-
-       return point;
-}
-
-
 #define GRAVE_LINE_WIDTH 31
 
 /*!
@@ -6222,7 +6105,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;
 
@@ -6259,12 +6142,12 @@ static void make_bones(void)
        if (!(p_ptr->noscore & 0x00FF))
        {
                /* Ignore people who die in town */
-               if (dun_level)
+               if (current_floor_ptr->dun_level)
                {
                        char tmp[128];
 
                        /* "Bones" name */
-                       sprintf(tmp, "bone.%03d", dun_level);
+                       sprintf(tmp, "bone.%03d", current_floor_ptr->dun_level);
 
                        /* Build the filename */
                        path_build(str, sizeof(str), ANGBAND_DIR_BONE, tmp);
@@ -6318,7 +6201,7 @@ bool (*tombstone_aux)(void) = NULL;
  * Display a "tomb-stone"
  * @return なし
  */
-static void print_tomb(void)
+void print_tomb(void)
 {
        bool done = FALSE;
 
@@ -6332,7 +6215,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];
@@ -6467,9 +6350,9 @@ static void print_tomb(void)
 
                if (!streq(p_ptr->died_from, "ripe") && !streq(p_ptr->died_from, "Seppuku"))
                {
-                       if (dun_level == 0)
+                       if (current_floor_ptr->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);
@@ -6483,18 +6366,18 @@ static void print_tomb(void)
                        {
                                if (streq(p_ptr->died_from, "途中終了"))
                                {
-                                       sprintf(tmp, "地下 %d 階で死んだ", (int)dun_level);
+                                       sprintf(tmp, "地下 %d 階で死んだ", (int)current_floor_ptr->dun_level);
                                }
                                else
                                {
-                                       sprintf(tmp, "に地下 %d 階で殺された", (int)dun_level);
+                                       sprintf(tmp, "に地下 %d 階で殺された", (int)current_floor_ptr->dun_level);
                                }
                        }
                        center_string(buf, tmp);
                        put_str(buf, 15 + extra_line, 11);
                }
 #else
-               (void)sprintf(tmp, "Killed on Level %d", dun_level);
+               (void)sprintf(tmp, "Killed on Level %d", current_floor_ptr->dun_level);
                center_string(buf, tmp);
                put_str(buf, 14, 11);
 
@@ -6528,18 +6411,16 @@ static void print_tomb(void)
  * Display some character info
  * @return なし
  */
-static void show_info(void)
+void show_info(void)
 {
        int             i, j, k, l;
-       object_type             *o_ptr;
+       object_type *o_ptr;
        store_type              *st_ptr;
 
        /* Hack -- Know everything in the inven/equip */
        for (i = 0; i < INVEN_TOTAL; i++)
        {
-               o_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Aware and Known */
@@ -6549,14 +6430,12 @@ static void show_info(void)
 
        for (i = 1; i < max_towns; i++)
        {
-               st_ptr = &town[i].store[STORE_HOME];
+               st_ptr = &town_info[i].store[STORE_HOME];
 
                /* Hack -- Know everything in the home */
                for (j = 0; j < st_ptr->stock_num; j++)
                {
                        o_ptr = &st_ptr->stock[j];
-
-                       /* Skip non-objects */
                        if (!o_ptr->k_idx) continue;
 
                        /* Aware and Known */
@@ -6605,17 +6484,17 @@ static void show_info(void)
        update_playtime();
        display_player(0);
 
-       /* Prompt for inventory */
+       /* Prompt for p_ptr->inventory_list */
        prt(_("何かキーを押すとさらに情報が続きます (ESCで中断): ", "Hit any key to see more information (ESC to abort): "), 23, 0);
 
        /* Allow abort at this point */
        if (inkey() == ESCAPE) return;
 
 
-       /* Show equipment and inventory */
+       /* Show equipment and p_ptr->inventory_list */
 
        /* Equipment -- if any */
-       if (equip_cnt)
+       if (p_ptr->equip_cnt)
        {
                Term_clear();
                (void)show_equip(0, USE_FULL);
@@ -6625,7 +6504,7 @@ static void show_info(void)
        }
 
        /* Inventory -- if any */
-       if (inven_cnt)
+       if (p_ptr->inven_cnt)
        {
                Term_clear();
                (void)show_inven(0, USE_FULL);
@@ -6637,7 +6516,7 @@ static void show_info(void)
        /* Homes in the different towns */
        for (l = 1; l < max_towns; l++)
        {
-               st_ptr = &town[l].store[STORE_HOME];
+               st_ptr = &town_info[l].store[STORE_HOME];
 
                /* Home -- if anything there */
                if (st_ptr->stock_num)
@@ -6675,190 +6554,6 @@ static void show_info(void)
        }
 }
 
-/*!
- * @brief スコアファイル出力
- * Display some character info
- * @return なし
- */
-static bool check_score(void)
-{
-       Term_clear();
-
-       /* No score file */
-       if (highscore_fd < 0)
-       {
-               msg_print(_("スコア・ファイルが使用できません。", "Score file unavailable."));
-               msg_print(NULL);
-               return FALSE;
-       }
-
-#ifndef SCORE_WIZARDS
-       /* Wizard-mode pre-empts scoring */
-       if (p_ptr->noscore & 0x000F)
-       {
-               msg_print(_("ウィザード・モードではスコアが記録されません。", "Score not registered for wizards."));
-               msg_print(NULL);
-               return FALSE;
-       }
-#endif
-
-#ifndef SCORE_BORGS
-       /* Borg-mode pre-empts scoring */
-       if (p_ptr->noscore & 0x00F0)
-       {
-               msg_print(_("ボーグ・モードではスコアが記録されません。", "Score not registered for borgs."));
-               msg_print(NULL);
-               return FALSE;
-       }
-#endif
-
-#ifndef SCORE_CHEATERS
-       /* Cheaters are not scored */
-       if (p_ptr->noscore & 0xFF00)
-       {
-               msg_print(_("詐欺をやった人はスコアが記録されません。", "Score not registered for cheaters."));
-               msg_print(NULL);
-               return FALSE;
-       }
-#endif
-
-       /* Interupted */
-       if (!p_ptr->total_winner && streq(p_ptr->died_from, _("強制終了", "Interrupting")))
-       {
-               msg_print(_("強制終了のためスコアが記録されません。", "Score not registered due to interruption."));
-               msg_print(NULL);
-               return FALSE;
-       }
-
-       /* Quitter */
-       if (!p_ptr->total_winner && streq(p_ptr->died_from, _("途中終了", "Quitting")))
-       {
-               msg_print(_("途中終了のためスコアが記録されません。", "Score not registered due to quitting."));
-               msg_print(NULL);
-               return FALSE;
-       }
-       return TRUE;
-}
-
-/*!
- * @brief ゲーム終了処理 /
- * Close up the current game (player may or may not be dead)
- * @return なし
- * @details
- * <pre>
- * This function is called only from "main.c" and "signals.c".
- * </pre>
- */
-void close_game(void)
-{
-       char buf[1024];
-       bool do_send = TRUE;
-
-/*     cptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
-       handle_stuff();
-
-       /* Flush the messages */
-       msg_print(NULL);
-
-       /* Flush the input */
-       flush();
-
-
-       /* No suspending now */
-       signals_ignore_tstp();
-
-
-       /* Hack -- Character is now "icky" */
-       character_icky = TRUE;
-
-
-       /* Build the filename */
-       path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
-       /* Grab permissions */
-       safe_setuid_grab();
-
-       /* Open the high score file, for reading/writing */
-       highscore_fd = fd_open(buf, O_RDWR);
-
-       /* Drop permissions */
-       safe_setuid_drop();
-
-       /* Handle death */
-       if (p_ptr->is_dead)
-       {
-               /* Handle retirement */
-               if (p_ptr->total_winner) kingly();
-
-               /* Save memories */
-               if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
-               {
-                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
-               }
-               else do_send = FALSE;
-
-               /* You are dead */
-               print_tomb();
-
-               flush();
-
-               /* Show more info */
-               show_info();
-               Term_clear();
-
-               if (check_score())
-               {
-                       if ((!send_world_score(do_send)))
-                       {
-                               if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
-                                                               (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
-                               {
-                                       p_ptr->wait_report_score = TRUE;
-                                       p_ptr->is_dead = FALSE;
-                                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
-                               }
-                       }
-                       if (!p_ptr->wait_report_score)
-                               (void)top_twenty();
-               }
-               else if (highscore_fd >= 0)
-               {
-                       display_scores_aux(0, 10, -1, NULL);
-               }
-#if 0
-               /* Dump bones file */
-               make_bones();
-#endif
-       }
-
-       /* Still alive */
-       else
-       {
-               /* Save the game */
-               do_cmd_save_game(FALSE);
-
-               /* Prompt for scores */
-               prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
-
-               /* Predict score (or ESCAPE) */
-               if (inkey() != ESCAPE) predict_score();
-       }
-
-
-       /* Shut the high score file */
-       (void)fd_close(highscore_fd);
-
-       /* Forget the high score fd */
-       highscore_fd = -1;
-
-       /* Kill all temporal files */
-       clear_saved_floor_files();
-
-       /* Allow suspending now */
-       signals_handle_tstp();
-}
-
 
 /*!
  * @brief 異常発生時のゲーム緊急終了処理 /
@@ -6875,7 +6570,7 @@ void close_game(void)
 void exit_game_panic(void)
 {
        /* If nothing important has happened, just quit */
-       if (!character_generated || character_saved) quit(_("緊急事態", "panic"));
+       if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(_("緊急事態", "panic"));
 
        /* Mega-Hack -- see "msg_print()" */
        msg_flag = FALSE;
@@ -6883,7 +6578,7 @@ void exit_game_panic(void)
        /* Clear the top line */
        prt("", 0, 0);
 
-       /* Hack -- turn off some things */
+       /* Hack -- current_world_ptr->game_turn off some things */
        disturb(TRUE, TRUE);
 
        /* Mega-Hack -- Delay death */
@@ -6918,7 +6613,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];
@@ -7027,7 +6722,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;
@@ -7049,7 +6744,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];
 
@@ -7070,21 +6765,21 @@ 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;
-       bool old_character_xtra = character_xtra;
+       bool old_character_xtra = current_world_ptr->character_xtra;
 
        /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
 
        /* Hack -- prevent modification birth options in this file */
-       character_xtra = TRUE;
+       current_world_ptr->character_xtra = TRUE;
 
        err = process_pref_file_aux(buf, PREF_TYPE_HISTPREF);
 
-       character_xtra = old_character_xtra;
+       current_world_ptr->character_xtra = old_character_xtra;
        return (err);
 }
 
@@ -7104,7 +6799,7 @@ static errr counts_seek(int fd, u32b where, bool flag)
        int i;
 
 #ifdef SAVEFILE_USE_UID
-       (void)sprintf(temp1, "%d.%s.%d%d%d", player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
+       (void)sprintf(temp1, "%d.%s.%d%d%d", p_ptr->player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
 #else
        (void)sprintf(temp1, "%s.%d%d%d", savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
 #endif
@@ -7295,7 +6990,7 @@ static void handle_signal_simple(int sig)
 
 
        /* Nothing to save, just quit */
-       if (!character_generated || character_saved) quit(NULL);
+       if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(NULL);
 
 
        /* Count the signals */
@@ -7334,8 +7029,6 @@ static void handle_signal_simple(int sig)
 
                /* Suicide */
                p_ptr->is_dead = TRUE;
-
-               /* Leaving */
                p_ptr->leaving = TRUE;
 
                /* Close stuff */
@@ -7400,7 +7093,7 @@ static void handle_signal_abort(int sig)
 
 
        /* Nothing to save, just quit */
-       if (!character_generated || character_saved) quit(NULL);
+       if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(NULL);
 
 
        forget_lite();