OSDN Git Service

[Refactor] #38997 do_cmd_write_nikki() に player_type * 引数を追加.
[hengband/hengband.git] / src / files.c
index 1f4a655..c555df6 100644 (file)
@@ -26,6 +26,7 @@
 #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"
@@ -653,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;
                                        }
@@ -1146,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 */
@@ -1367,8 +1365,6 @@ errr check_time_init(void)
        char    buf[1024];
 
        path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "time.txt");
-
-       /* Open the file */
        fp = my_fopen(buf, "r");
 
        /* No file, no restrictions */
@@ -1752,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);
@@ -1789,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)
@@ -2135,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)
@@ -2270,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;
 
@@ -2297,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
                {
@@ -2719,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;
 
@@ -2892,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;
 
@@ -2929,8 +2919,6 @@ 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;
 
@@ -2954,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;
 
@@ -2981,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;
 
@@ -3900,7 +3884,7 @@ void display_player(int mode)
                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);
 #endif
-               display_player_one_line(ENTRY_ALIGN, format("%s" ,your_alignment()), TERM_L_BLUE);
+               display_player_one_line(ENTRY_ALIGN, format("%s" ,your_alignment(p_ptr)), TERM_L_BLUE);
 
 
                /* Display the stats */
@@ -4085,7 +4069,7 @@ void display_player(int mode)
 
        else if (mode == 4)
        {
-               do_cmd_knowledge_mutations();
+               do_cmd_knowledge_mutations(p_ptr);
        }
 }
 
@@ -4855,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);
 }
 
 
@@ -4871,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);
        }
 }
 
@@ -5318,35 +5302,24 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG
 
        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);
                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);
                path_build(path, sizeof(path), ANGBAND_DIR_INFO, name);
-
-               /* Open the file */
                fff = my_fopen(path, "r");
        }
 
@@ -5359,10 +5332,7 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG
                        if ('\\' == path[i])
                                path[i] = PATH_SEP[0];
 
-               /* Caption */
                sprintf(caption, _("スポイラー・ファイル'%s'", "Info file '%s'"), name);
-
-               /* Open the file */
                fff = my_fopen(path, "r");
        }
 
@@ -6065,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 ----"));
+       do_cmd_write_nikki(p_ptr, NIKKI_GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
 }
 
 
@@ -6512,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 */
@@ -6589,8 +6558,6 @@ errr get_rnd_line(concptr file_name, int entry, char *output)
        int     line_num = 0;
 
        path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, file_name);
-
-       /* Open the file */
        fp = my_fopen(buf, "r");
 
        /* Failed */
@@ -7072,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 ----"));
+       do_cmd_write_nikki(p_ptr, NIKKI_GAMESTART, 0, _("----ゲーム異常終了----", "---- Panic Save and Abort Game ----"));
 
        /* Flush output */
        Term_fresh();