OSDN Git Service

[Refactor] #38997 disterb() に player_type * 引数を追加. / Add player_type * argument to...
[hengband/hengband.git] / src / files.c
index 8925515..c0bacec 100644 (file)
 
 #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"
@@ -149,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!"));
        }
@@ -643,7 +645,7 @@ errr process_pref_file_command(char *buf)
                                        int ob = option_info[i].o_bit;
 
                                        if ((p_ptr->playing || current_world_ptr->character_xtra) &&
-                                               (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
+                                               (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);
@@ -652,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;
                                        }
@@ -1145,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 */
@@ -1273,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 */
@@ -1283,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 */
@@ -1369,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 */
@@ -1495,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 */
@@ -1759,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);
@@ -1796,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)
@@ -2142,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)
@@ -2277,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;
 
@@ -2304,13 +2291,13 @@ 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
                {
@@ -2726,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;
 
@@ -2742,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);
@@ -2899,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;
 
@@ -2936,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);
 }
 
@@ -2961,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;
 
@@ -2988,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;
 
@@ -3000,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);
 }
@@ -3093,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;
@@ -3613,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)
                        {
@@ -3853,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);
@@ -3872,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;
 
@@ -3922,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);
@@ -3931,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);
@@ -3947,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));
                        }
@@ -3967,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. */
@@ -3999,17 +3976,17 @@ 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
                                }
                        }
@@ -4019,7 +3996,7 @@ void display_player(int mode)
                                {
                                        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 */
@@ -4034,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
                                {
@@ -4092,7 +4069,7 @@ void display_player(int mode)
 
        else if (mode == 4)
        {
-               do_cmd_knowledge_mutations();
+               do_cmd_knowledge_mutations(creature_ptr);
        }
 }
 
@@ -4108,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++)
@@ -4134,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++)
@@ -4162,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++)
@@ -4193,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++)
@@ -4862,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);
 }
 
 
@@ -4878,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);
        }
 }
 
@@ -5050,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" */
@@ -5299,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);
@@ -5333,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");
        }
 
@@ -5743,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 */
@@ -5946,14 +5891,12 @@ void process_player_name(bool sf)
                strcpy(savefile_base, p_ptr->base_name);
 
 #ifdef SAVEFILE_USE_UID
-               /* Rename the savefile, using the player_uid and p_ptr->base_name */
-               (void)sprintf(temp, "%d.%s", player_uid, p_ptr->base_name);
+               /* 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 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);
        }
 
@@ -5971,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.  
@@ -6032,7 +5975,7 @@ void do_cmd_save_game(int is_autosave)
        }
        else
        {
-               disturb(TRUE, TRUE);
+               disturb(p_ptr, TRUE, TRUE);
        }
 
        /* Clear messages */
@@ -6092,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 ----"));
 }
 
 
@@ -6147,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 */
@@ -6225,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 */
@@ -6481,7 +6420,7 @@ void show_info(void)
        }
 
        update_playtime();
-       display_player(0);
+       display_player(p_ptr, 0);
 
        /* Prompt for p_ptr->inventory_list */
        prt(_("何かキーを押すとさらに情報が続きます (ESCで中断): ", "Hit any key to see more information (ESC to abort): "), 23, 0);
@@ -6496,7 +6435,7 @@ void show_info(void)
        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;
@@ -6506,7 +6445,7 @@ void show_info(void)
        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;
@@ -6543,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 */
@@ -6578,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;
@@ -6619,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 */
@@ -6748,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);
@@ -6769,8 +6701,6 @@ errr process_histpref_file(concptr name)
        char buf[1024];
        errr err = 0;
        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 */
@@ -6798,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
@@ -7004,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();
@@ -7021,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;
@@ -7097,7 +7027,7 @@ static void handle_signal_abort(int sig)
 
        forget_lite();
        forget_view();
-       clear_mon_lite();
+       clear_mon_lite(current_floor_ptr);
 
        /* Clear the bottom line */
        Term_erase(0, hgt - 1, 255);
@@ -7109,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();