OSDN Git Service

[Refactor] #38997 disterb() に player_type * 引数を追加. / Add player_type * argument to...
[hengband/hengband.git] / src / files.c
index 61e37bf..c0bacec 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-inventory.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 "artifact.h"
 #include "avatar.h"
 #include "shoot.h"
-#include "player-move.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 "player-skill.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];
+
 
 
 /*
@@ -111,11 +151,11 @@ void safe_setuid_grab(void)
 
 #  ifdef SAFE_SETUID_POSIX
 
-       if (setuid(player_euid) != 0)
+       if (setuid(p_ptr->player_egid) != 0)
        {
                quit(_("setuid(): 正しく許可が取れません!", "setuid(): cannot set permissions correctly!"));
        }
-       if (setgid(player_egid) != 0)
+       if (setgid(p_ptr->player_egid) != 0)
        {
                quit(_("setgid(): 正しく許可が取れません!", "setgid(): cannot set permissions correctly!"));
        }
@@ -366,7 +406,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\>
@@ -530,7 +570,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)
                        {
@@ -604,8 +644,8 @@ 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) &&
-                                               (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
+                                       if ((p_ptr->playing || current_world_ptr->character_xtra) &&
+                                               (OPT_PAGE_BIRTH == option_info[i].o_page) && !current_world_ptr->wizard)
                                        {
                                                msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
                                                msg_print(NULL);
@@ -614,7 +654,6 @@ errr process_pref_file_command(char *buf)
 
                                        if (buf[0] == 'X')
                                        {
-                                               /* Clear */
                                                option_flag[os] &= ~(1L << ob);
                                                (*option_info[i].o_var) = FALSE;
                                        }
@@ -1107,8 +1146,6 @@ static errr process_pref_file_aux(concptr name, int preftype)
 
        bool bypass = FALSE;
 
-
-       /* Open the file */
        fp = my_fopen(name, "r");
 
        /* No such file */
@@ -1235,8 +1272,6 @@ errr process_pref_file(concptr name)
        char buf[1024];
 
        errr err1, err2;
-
-       /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_PREF, name);
 
        /* Process the system pref file */
@@ -1245,8 +1280,6 @@ errr process_pref_file(concptr name)
        /* Stop at parser errors, but not at non-existing file */
        if (err1 > 0) return err1;
 
-
-       /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
        
        /* Process the user pref file */
@@ -1331,11 +1364,7 @@ errr check_time_init(void)
 
        char    buf[1024];
 
-
-       /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "time.txt");
-
-       /* Open the file */
        fp = my_fopen(buf, "r");
 
        /* No file, no restrictions */
@@ -1457,8 +1486,6 @@ errr check_load_init(void)
        char    temphost[MAXHOSTNAMELEN+1];
        char    thishost[MAXHOSTNAMELEN+1];
 
-
-       /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "load.txt");
 
        /* Open the "load" file */
@@ -1709,7 +1736,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;
@@ -1721,7 +1748,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 (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM))
+       if (!has_melee_weapon(p_ptr, INVEN_RARM) && !has_melee_weapon(p_ptr, 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);
@@ -1744,7 +1771,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,7 +1785,7 @@ static void display_player_middle(void)
        {
                display_player_melee_bonus(1, left_hander ? ENTRY_RIGHT_HAND2: ENTRY_LEFT_HAND2);
        }
-       else if ((p_ptr->pclass == CLASS_MONK) && (empty_hands(TRUE) & EMPTY_HAND_RARM))
+       else if ((p_ptr->pclass == CLASS_MONK) && (empty_hands(p_ptr, TRUE) & EMPTY_HAND_RARM))
        {
                int i;
                if (p_ptr->special_defense & KAMAE_MASK)
@@ -1788,9 +1815,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++;
@@ -2065,7 +2092,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);
 
@@ -2104,7 +2131,7 @@ static void display_player_various(void)
        for(i = 0; i < 2; i++)
        {
                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))
+               if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && (empty_hands(p_ptr, TRUE) & EMPTY_HAND_RARM))
                {
                        PLAYER_LEVEL level = p_ptr->lev;
                        if (i)
@@ -2122,7 +2149,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)
@@ -2239,8 +2266,6 @@ static void display_player_various(void)
 static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
-
-       /* Clear */
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
@@ -2266,18 +2291,18 @@ static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
                break;
        case CLASS_MONK:
        case CLASS_FORCETRAINER:
-               if ((p_ptr->lev > 9) && !heavy_armor())
+               if ((p_ptr->lev > 9) && !heavy_armor(p_ptr))
                        add_flag(flgs, TR_SPEED);
-               if ((p_ptr->lev>24) && !heavy_armor())
+               if ((p_ptr->lev>24) && !heavy_armor(p_ptr))
                        add_flag(flgs, TR_FREE_ACT);
                break;
        case CLASS_NINJA:
-               if (heavy_armor())
+               if (heavy_armor(p_ptr))
                        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);
@@ -2688,8 +2713,6 @@ static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 static void tim_player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
-
-       /* Clear */
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
@@ -2704,7 +2727,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_(p_ptr, 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);
@@ -2833,7 +2856,7 @@ 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);
@@ -2861,8 +2884,6 @@ void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 static void known_obj_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
-
-       /* Clear */
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
@@ -2874,7 +2895,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;
 
@@ -2898,18 +2919,16 @@ static void known_obj_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 static void player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
-
-       /* Clear */
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
-       if (prace_is_(RACE_SPECTRE))
+       if (PRACE_IS_(p_ptr, 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_(p_ptr, 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_(p_ptr, RACE_YEEK) && p_ptr->lev > 19)
                add_flag(flgs, TR_RES_ACID);
 }
 
@@ -2923,8 +2942,6 @@ static void player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 static void tim_player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
-
-       /* Clear */
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
@@ -2950,8 +2967,6 @@ static void tim_player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 static void player_vuln_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
-
-       /* Clear */
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
@@ -2962,11 +2977,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_(p_ptr, RACE_ANDROID))
                add_flag(flgs, TR_RES_ELEC);
-       if (prace_is_(RACE_ENT))
+       if (PRACE_IS_(p_ptr, RACE_ENT))
                add_flag(flgs, TR_RES_FIRE);
-       if (prace_is_(RACE_VAMPIRE) || prace_is_(RACE_S_FAIRY) ||
+       if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || PRACE_IS_(p_ptr, RACE_S_FAIRY) ||
            (p_ptr->mimic_form == MIMIC_VAMPIRE))
                add_flag(flgs, TR_RES_LITE);
 }
@@ -3025,7 +3040,7 @@ static void display_flag_aux(TERM_LEN row, TERM_LEN col, concptr 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);
@@ -3055,12 +3070,12 @@ static void display_flag_aux(TERM_LEN row, TERM_LEN col, concptr 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;
@@ -3575,7 +3590,7 @@ static void display_player_stat_info(void)
                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_(p_ptr, RACE_ENT))
                {
                        switch (i)
                        {
@@ -3645,7 +3660,7 @@ static void display_player_stat_info(void)
        /* Process equipment */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Acquire "known" flags */
                object_flags_known(o_ptr, flgs);
@@ -3815,13 +3830,13 @@ static void display_player_stat_info(void)
  * Mode 4 = mutations
  * </pre>
  */
-void display_player(int mode)
+void display_player(player_type *creature_ptr, int mode)
 {
        int i;
        char buf[80];
        char tmp[64];
 
-       if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && display_mutations)
+       if ((creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) && display_mutations)
                mode = (mode % 5);
        else
                mode = (mode % 4);
@@ -3834,49 +3849,49 @@ void display_player(int mode)
        {
                /* Name, Sex, Race, Class */
 #ifdef JP
-               sprintf(tmp, "%s%s%s", ap_ptr->title, ap_ptr->no == 1 ? "の":"", p_ptr->name);
+               sprintf(tmp, "%s%s%s", ap_ptr->title, ap_ptr->no == 1 ? "の":"", creature_ptr->name);
 #else
-               sprintf(tmp, "%s %s", ap_ptr->title, p_ptr->name);
+               sprintf(tmp, "%s %s", ap_ptr->title, creature_ptr->name);
 #endif
 
                display_player_one_line(ENTRY_NAME, tmp, TERM_L_BLUE);
                display_player_one_line(ENTRY_SEX, sp_ptr->title, TERM_L_BLUE);
-               display_player_one_line(ENTRY_RACE, (p_ptr->mimic_form ? mimic_info[p_ptr->mimic_form].title : rp_ptr->title), TERM_L_BLUE);
+               display_player_one_line(ENTRY_RACE, (creature_ptr->mimic_form ? mimic_info[creature_ptr->mimic_form].title : rp_ptr->title), TERM_L_BLUE);
                display_player_one_line(ENTRY_CLASS, cp_ptr->title, TERM_L_BLUE);
 
-               if (p_ptr->realm1)
+               if (creature_ptr->realm1)
                {
-                       if (p_ptr->realm2)
-                               sprintf(tmp, "%s, %s", realm_names[p_ptr->realm1], realm_names[p_ptr->realm2]);
+                       if (creature_ptr->realm2)
+                               sprintf(tmp, "%s, %s", realm_names[creature_ptr->realm1], realm_names[creature_ptr->realm2]);
                        else
-                               strcpy(tmp, realm_names[p_ptr->realm1]);
+                               strcpy(tmp, realm_names[creature_ptr->realm1]);
                        display_player_one_line(ENTRY_REALM, tmp, TERM_L_BLUE);
                }
 
-               if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
-                       display_player_one_line(ENTRY_PATRON, chaos_patrons[p_ptr->chaos_patron], TERM_L_BLUE);
+               if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) || (creature_ptr->muta2 & MUT2_CHAOS_GIFT))
+                       display_player_one_line(ENTRY_PATRON, chaos_patrons[creature_ptr->chaos_patron], TERM_L_BLUE);
 
                /* Age, Height, Weight, Social */
                /* 身長はセンチメートルに、体重はキログラムに変更してあります */
 #ifdef JP
-               display_player_one_line(ENTRY_AGE, format("%d才" ,(int)p_ptr->age), TERM_L_BLUE);
-               display_player_one_line(ENTRY_HEIGHT, format("%dcm" ,(int)((p_ptr->ht*254)/100)), TERM_L_BLUE);
-               display_player_one_line(ENTRY_WEIGHT, format("%dkg" ,(int)((p_ptr->wt*4536)/10000)), TERM_L_BLUE);
-               display_player_one_line(ENTRY_SOCIAL, format("%d  " ,(int)p_ptr->sc), TERM_L_BLUE);
+               display_player_one_line(ENTRY_AGE, format("%d才" ,(int)creature_ptr->age), TERM_L_BLUE);
+               display_player_one_line(ENTRY_HEIGHT, format("%dcm" ,(int)((creature_ptr->ht*254)/100)), TERM_L_BLUE);
+               display_player_one_line(ENTRY_WEIGHT, format("%dkg" ,(int)((creature_ptr->wt*4536)/10000)), TERM_L_BLUE);
+               display_player_one_line(ENTRY_SOCIAL, format("%d  " ,(int)creature_ptr->sc), TERM_L_BLUE);
 #else
-               display_player_one_line(ENTRY_AGE, format("%d" ,(int)p_ptr->age), TERM_L_BLUE);
-               display_player_one_line(ENTRY_HEIGHT, format("%d" ,(int)p_ptr->ht), TERM_L_BLUE);
-               display_player_one_line(ENTRY_WEIGHT, format("%d" ,(int)p_ptr->wt), TERM_L_BLUE);
-               display_player_one_line(ENTRY_SOCIAL, format("%d" ,(int)p_ptr->sc), TERM_L_BLUE);
+               display_player_one_line(ENTRY_AGE, format("%d" ,(int)creature_ptr->age), TERM_L_BLUE);
+               display_player_one_line(ENTRY_HEIGHT, format("%d" ,(int)creature_ptr->ht), TERM_L_BLUE);
+               display_player_one_line(ENTRY_WEIGHT, format("%d" ,(int)creature_ptr->wt), TERM_L_BLUE);
+               display_player_one_line(ENTRY_SOCIAL, format("%d" ,(int)creature_ptr->sc), TERM_L_BLUE);
 #endif
-               display_player_one_line(ENTRY_ALIGN, format("%s" ,your_alignment()), TERM_L_BLUE);
+               display_player_one_line(ENTRY_ALIGN, format("%s" ,your_alignment(creature_ptr)), TERM_L_BLUE);
 
 
                /* Display the stats */
                for (i = 0; i < A_MAX; i++)
                {
                        /* Special treatment of "injured" stats */
-                       if (p_ptr->stat_cur[i] < p_ptr->stat_max[i])
+                       if (creature_ptr->stat_cur[i] < creature_ptr->stat_max[i])
                        {
                                int value;
 
@@ -3884,7 +3899,7 @@ void display_player(int mode)
                                put_str(stat_names_reduced[i], 3 + i, 53);
 
                                /* Get the current stat */
-                               value = p_ptr->stat_use[i];
+                               value = creature_ptr->stat_use[i];
 
                                /* Obtain the current stat (modified) */
                                cnv_stat(value, buf);
@@ -3893,7 +3908,7 @@ void display_player(int mode)
                                c_put_str(TERM_YELLOW, buf, 3 + i, 60);
 
                                /* Acquire the max stat */
-                               value = p_ptr->stat_top[i];
+                               value = creature_ptr->stat_top[i];
 
                                /* Obtain the maximum stat (modified) */
                                cnv_stat(value, buf);
@@ -3909,13 +3924,13 @@ void display_player(int mode)
                                put_str(stat_names[i], 3 + i, 53);
 
                                /* Obtain the current stat (modified) */
-                               cnv_stat(p_ptr->stat_use[i], buf);
+                               cnv_stat(creature_ptr->stat_use[i], buf);
 
                                /* Display the current stat (modified) */
                                c_put_str(TERM_L_GREEN, buf, 3 + i, 60);
                        }
 
-                       if (p_ptr->stat_max[i] == p_ptr->stat_max_max[i])
+                       if (creature_ptr->stat_max[i] == creature_ptr->stat_max_max[i])
                        {
                                c_put_str(TERM_WHITE, "!", 3 + i, _(58, 58-2));
                        }
@@ -3929,30 +3944,30 @@ void display_player(int mode)
 
                        for (i = 0; i < 4; i++)
                        {
-                               put_str(p_ptr->history[i], i + 12, 10);
+                               put_str(creature_ptr->history[i], i + 12, 10);
                        }
 
                        *statmsg = '\0';
 
-                       if (p_ptr->is_dead)
+                       if (creature_ptr->is_dead)
                        {
-                               if (p_ptr->total_winner)
+                               if (creature_ptr->total_winner)
                                {
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは勝利の後%sした。", streq(p_ptr->died_from, "Seppuku") ? "切腹" : "引退");
+                                       sprintf(statmsg, "…あなたは勝利の後%sした。", streq(creature_ptr->died_from, "Seppuku") ? "切腹" : "引退");
 #else
-                                       sprintf(statmsg, "...You %s after the winning.", streq(p_ptr->died_from, "Seppuku") ? "did Seppuku" : "retired from the adventure");
+                                       sprintf(statmsg, "...You %s after the winning.", streq(creature_ptr->died_from, "Seppuku") ? "did Seppuku" : "retired from the adventure");
 #endif
                                }
                                else if (!current_floor_ptr->dun_level)
                                {
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは%sで%sに殺された。", map_name(), p_ptr->died_from);
+                                       sprintf(statmsg, "…あなたは%sで%sに殺された。", map_name(), creature_ptr->died_from);
 #else
-                                       sprintf(statmsg, "...You were killed by %s in %s.", p_ptr->died_from, map_name());
+                                       sprintf(statmsg, "...You were killed by %s in %s.", creature_ptr->died_from, map_name());
 #endif
                                }
-                               else if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest))
+                               else if (creature_ptr->inside_quest && is_fixed_quest_idx(creature_ptr->inside_quest))
                                {
                                        /* Get the quest text */
                                        /* Bewere that INIT_ASSIGN resets the cur_num. */
@@ -3961,27 +3976,27 @@ void display_player(int mode)
                                        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは、クエスト「%s」で%sに殺された。", quest[p_ptr->inside_quest].name, p_ptr->died_from);
+                                       sprintf(statmsg, "…あなたは、クエスト「%s」で%sに殺された。", quest[creature_ptr->inside_quest].name, creature_ptr->died_from);
 #else
-                                       sprintf(statmsg, "...You were killed by %s in the quest '%s'.", p_ptr->died_from, quest[p_ptr->inside_quest].name);
+                                       sprintf(statmsg, "...You were killed by %s in the quest '%s'.", creature_ptr->died_from, quest[creature_ptr->inside_quest].name);
 #endif
                                }
                                else
                                {
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)current_floor_ptr->dun_level, p_ptr->died_from);
+                                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)current_floor_ptr->dun_level, creature_ptr->died_from);
 #else
-                                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", p_ptr->died_from, current_floor_ptr->dun_level, map_name());
+                                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", creature_ptr->died_from, current_floor_ptr->dun_level, map_name());
 #endif
                                }
                        }
-                       else if (character_dungeon)
+                       else if (current_world_ptr->character_dungeon)
                        {
                                if (!current_floor_ptr->dun_level)
                                {
                                        sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name());
                                }
-                               else if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest))
+                               else if (creature_ptr->inside_quest && is_fixed_quest_idx(creature_ptr->inside_quest))
                                {
                                        /* Clear the text */
                                        /* Must be done before doing INIT_SHOW_TEXT */
@@ -3996,7 +4011,7 @@ void display_player(int mode)
 
                                        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
-                                       sprintf(statmsg, _("…あなたは現在、 クエスト「%s」を遂行中だ。", "...Now, you are in the quest '%s'."), quest[p_ptr->inside_quest].name);
+                                       sprintf(statmsg, _("…あなたは現在、 クエスト「%s」を遂行中だ。", "...Now, you are in the quest '%s'."), quest[creature_ptr->inside_quest].name);
                                }
                                else
                                {
@@ -4054,7 +4069,7 @@ void display_player(int mode)
 
        else if (mode == 4)
        {
-               do_cmd_knowledge_mutations();
+               do_cmd_knowledge_mutations(creature_ptr);
        }
 }
 
@@ -4070,7 +4085,7 @@ static void dump_aux_display_player(FILE *fff)
        char c;
        char buf[1024];
 
-       display_player(0);
+       display_player(p_ptr, 0);
 
        /* Dump part of the screen */
        for (y = 1; y < 22; y++)
@@ -4096,7 +4111,7 @@ static void dump_aux_display_player(FILE *fff)
        }
 
        /* Display history */
-       display_player(1);
+       display_player(p_ptr, 1);
 
        /* Dump part of the screen */
        for (y = 10; y < 19; y++)
@@ -4124,7 +4139,7 @@ static void dump_aux_display_player(FILE *fff)
        fprintf(fff, "\n");
 
        /* Display flags (part 1) */
-       display_player(2);
+       display_player(p_ptr, 2);
 
        /* Dump part of the screen */
        for (y = 2; y < 22; y++)
@@ -4155,7 +4170,7 @@ static void dump_aux_display_player(FILE *fff)
        fprintf(fff, "\n");
 
        /* Display flags (part 2) */
-       display_player(3);
+       display_player(p_ptr, 3);
 
        /* Dump part of the screen */
        for (y = 1; y < 22; y++)
@@ -4199,7 +4214,7 @@ 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 = &current_floor_ptr->m_list[i];
 
@@ -4824,9 +4839,9 @@ static void dump_aux_virtues(FILE *fff)
                        else fprintf(fff, "%s ???\n", stat_names[v_nr]);
                }
 
-       fprintf(fff, _("\n属性 : %s\n", "\nYour alighnment : %s\n"), your_alignment());
+       fprintf(fff, _("\n属性 : %s\n", "\nYour alighnment : %s\n"), your_alignment(p_ptr));
        fprintf(fff, "\n");
-       dump_virtues(fff);
+       dump_virtues(p_ptr, fff);
 }
 
 
@@ -4840,7 +4855,7 @@ static void dump_aux_mutations(FILE *fff)
        if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
        {
                fprintf(fff, _("\n\n  [突然変異]\n\n", "\n\n  [Mutations]\n\n"));
-               dump_mutations(fff);
+               dump_mutations(p_ptr, fff);
        }
 }
 
@@ -4856,12 +4871,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)"));
 
@@ -4871,16 +4886,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);
        }
 
@@ -5012,8 +5027,6 @@ errr file_character(concptr name)
        int             fd = -1;
        FILE            *fff = NULL;
        char            buf[1024];
-
-       /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
 
        /* File type is "TEXT" */
@@ -5261,22 +5274,14 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG
        Term_get_size(&wid, &hgt);
        rows = hgt - 4;
 
-       /* Wipe finder */
        strcpy(finder_str, "");
-
-       /* Wipe shower */
        strcpy(shower_str, "");
-
-       /* Wipe caption */
        strcpy(caption, "");
-
-       /* Wipe the hooks */
        for (i = 0; i < 68; i++)
        {
                hook[i][0] = '\0';
        }
 
-       /* Copy the filename */
        strcpy(filename, name);
 
        n = strlen(filename);
@@ -5295,59 +5300,39 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG
        /* Redirect the name */
        name = filename;
 
-       /* Hack */
        if (what)
        {
-               /* Caption */
                strcpy(caption, what);
-
-               /* Access the "file" */
                strcpy(path, name);
-
-               /* Open */
                fff = my_fopen(path, "r");
        }
 
        /* Look in "help" */
        if (!fff)
        {
-               /* Caption */
                sprintf(caption, _("ヘルプ・ファイル'%s'", "Help file '%s'"), name);
-
-               /* Build the filename */
                path_build(path, sizeof(path), ANGBAND_DIR_HELP, name);
-
-               /* Open the file */
                fff = my_fopen(path, "r");
        }
 
        /* Look in "info" */
        if (!fff)
        {
-               /* Caption */
                sprintf(caption, _("スポイラー・ファイル'%s'", "Info file '%s'"), name);
-
-               /* Build the filename */
                path_build(path, sizeof(path), ANGBAND_DIR_INFO, name);
-
-               /* Open the file */
                fff = my_fopen(path, "r");
        }
 
        /* Look in "info" */
        if (!fff)
        {
-               /* Build the filename */
                path_build(path, sizeof(path), ANGBAND_DIR, name);
 
                for (i = 0; path[i]; i++)
                        if ('\\' == path[i])
                                path[i] = PATH_SEP[0];
 
-               /* Caption */
                sprintf(caption, _("スポイラー・ファイル'%s'", "Info file '%s'"), name);
-
-               /* Open the file */
                fff = my_fopen(path, "r");
        }
 
@@ -5705,8 +5690,6 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG
 
                        if (!get_string(_("ファイル名: ", "File name: "), xtmp, 80)) continue;
                        my_fclose(fff);
-
-                       /* Build the filename */
                        path_build(buff, sizeof(buff), ANGBAND_DIR_USER, xtmp);
 
                        /* Hack -- Re-Open the file */
@@ -5783,7 +5766,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)
@@ -5828,7 +5811,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
@@ -5845,35 +5828,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
@@ -5905,24 +5888,22 @@ 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 */
                path_build(savefile, sizeof(savefile), ANGBAND_DIR_SAVE, temp);
        }
 
        /* 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);
        }
 }
 
@@ -5933,7 +5914,7 @@ void process_player_name(bool sf)
  * @return なし
  * @details
  * <pre>
- * Assumes that "display_player(0)" has just been called
+ * Assumes that "display_player(p_ptr, 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.  
@@ -5994,7 +5975,7 @@ void do_cmd_save_game(int is_autosave)
        }
        else
        {
-               disturb(TRUE, TRUE);
+               disturb(p_ptr, TRUE, TRUE);
        }
 
        /* Clear messages */
@@ -6032,7 +6013,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);
 
@@ -6040,7 +6021,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;
 }
 
 
@@ -6054,7 +6035,7 @@ void do_cmd_save_and_exit(void)
 {
        p_ptr->playing = FALSE;
        p_ptr->leaving = TRUE;
-       do_cmd_write_nikki(NIKKI_GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
+       exe_write_diary(p_ptr, NIKKI_GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
 }
 
 
@@ -6109,8 +6090,6 @@ static void make_bones(void)
 
                        /* "Bones" name */
                        sprintf(tmp, "bone.%03d", current_floor_ptr->dun_level);
-
-                       /* Build the filename */
                        path_build(str, sizeof(str), ANGBAND_DIR_BONE, tmp);
 
                        /* Attempt to open the bones file */
@@ -6187,8 +6166,6 @@ void print_tomb(void)
                int    extra_line = 0;
 #endif
                Term_clear();
-
-               /* Build the filename */
                path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("dead_j.txt", "dead.txt"));
 
                /* Open the News file */
@@ -6381,7 +6358,7 @@ void show_info(void)
        /* Hack -- Know everything in the inven/equip */
        for (i = 0; i < INVEN_TOTAL; i++)
        {
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Aware and Known */
@@ -6443,32 +6420,32 @@ void show_info(void)
        }
 
        update_playtime();
-       display_player(0);
+       display_player(p_ptr, 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);
+               (void)show_equip(0, USE_FULL, 0);
                prt(_("装備していたアイテム: -続く-", "You are using: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
        }
 
        /* Inventory -- if any */
-       if (inven_cnt)
+       if (p_ptr->inven_cnt)
        {
                Term_clear();
-               (void)show_inven(0, USE_FULL);
+               (void)show_inven(0, USE_FULL, 0);
                prt(_("持っていたアイテム: -続く-", "You are carrying: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
@@ -6505,7 +6482,6 @@ void show_info(void)
                                        c_put_str(tval_to_attr[o_ptr->tval], o_name, j+2, 7);
                                }
 
-                               /* Caption */
                                prt(format(_("我が家に置いてあったアイテム ( %d ページ): -続く-", "Your home contains (page %d): -more-"), k+1), 0, 0);
 
                                /* Wait for it */
@@ -6515,71 +6491,6 @@ void show_info(void)
        }
 }
 
-/*!
- * @brief スコアファイル出力
- * Display some character info
- * @return なし
- */
-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 異常発生時のゲーム緊急終了処理 /
@@ -6596,7 +6507,7 @@ bool check_score(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;
@@ -6605,7 +6516,7 @@ void exit_game_panic(void)
        prt("", 0, 0);
 
        /* Hack -- current_world_ptr->game_turn off some things */
-       disturb(TRUE, TRUE);
+       disturb(p_ptr, TRUE, TRUE);
 
        /* Mega-Hack -- Delay death */
        if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;
@@ -6646,11 +6557,7 @@ errr get_rnd_line(concptr file_name, int entry, char *output)
        int     counter, test;
        int     line_num = 0;
 
-
-       /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, file_name);
-
-       /* Open the file */
        fp = my_fopen(buf, "r");
 
        /* Failed */
@@ -6775,8 +6682,6 @@ errr process_autopick_file(concptr name)
        char buf[1024];
 
        errr err = 0;
-
-       /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
 
        err = process_pref_file_aux(buf, PREF_TYPE_AUTOPICK);
@@ -6795,17 +6700,15 @@ errr process_histpref_file(concptr name)
 {
        char buf[1024];
        errr err = 0;
-       bool old_character_xtra = character_xtra;
-
-       /* Build the filename */
+       bool old_character_xtra = current_world_ptr->character_xtra;
        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);
 }
 
@@ -6825,7 +6728,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
@@ -7016,7 +6919,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 */
@@ -7031,7 +6934,7 @@ static void handle_signal_simple(int sig)
 
                forget_lite();
                forget_view();
-               clear_mon_lite();
+               clear_mon_lite(current_floor_ptr);
 
                /* Close stuff */
                close_game();
@@ -7048,7 +6951,7 @@ static void handle_signal_simple(int sig)
 
                forget_lite();
                forget_view();
-               clear_mon_lite();
+               clear_mon_lite(current_floor_ptr);
 
                /* Stop playing */
                p_ptr->playing = FALSE;
@@ -7119,12 +7022,12 @@ 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();
        forget_view();
-       clear_mon_lite();
+       clear_mon_lite(current_floor_ptr);
 
        /* Clear the bottom line */
        Term_erase(0, hgt - 1, 255);
@@ -7136,7 +7039,7 @@ static void handle_signal_abort(int sig)
 
        Term_putstr(45, hgt - 1, -1, TERM_RED, _("緊急セーブ...", "Panic save..."));
 
-       do_cmd_write_nikki(NIKKI_GAMESTART, 0, _("----ゲーム異常終了----", "---- Panic Save and Abort Game ----"));
+       exe_write_diary(p_ptr, NIKKI_GAMESTART, 0, _("----ゲーム異常終了----", "---- Panic Save and Abort Game ----"));
 
        /* Flush output */
        Term_fresh();