OSDN Git Service

[Fix] #39587 英文校正("temporal" → "temporary") / Proofreading English "temporal" to...
[hengband/hengband.git] / src / core.c
index efa3d92..475240d 100644 (file)
@@ -603,8 +603,10 @@ static void sense_inventory2(player_type *creature_ptr)
        }
 }
 
+
 /*!
  * @brief パターン終点到達時のテレポート処理を行う
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 static void pattern_teleport(player_type *creature_ptr)
@@ -663,12 +665,12 @@ static void pattern_teleport(player_type *creature_ptr)
        /* Accept request */
        msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
 
-       if (autosave_l) do_cmd_save_game(TRUE);
+       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
        /* Change level */
        creature_ptr->current_floor_ptr->dun_level = command_arg;
 
-       leave_quest_check();
+       leave_quest_check(creature_ptr);
 
        if (record_stair) exe_write_diary(creature_ptr, NIKKI_PAT_TELE, 0, NULL);
 
@@ -679,7 +681,7 @@ static void pattern_teleport(player_type *creature_ptr)
         * Clear all saved floors
         * and create a first saved floor
         */
-       prepare_change_floor_mode(CFM_FIRST_FLOOR);
+       prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
        creature_ptr->leaving = TRUE;
 }
 
@@ -699,7 +701,8 @@ static bool pattern_effect(player_type *creature_ptr)
                wreck_the_pattern(creature_ptr);
        }
 
-       pattern_type = f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+       pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
 
        switch (pattern_type)
        {
@@ -709,7 +712,7 @@ static bool pattern_effect(player_type *creature_ptr)
                (void)restore_level(creature_ptr);
                (void)cure_critical_wounds(creature_ptr, 1000);
 
-               cave_set_feat(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
+               cave_set_feat(floor_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
                msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
 
                /*
@@ -1149,7 +1152,7 @@ static void check_music(player_type *caster_ptr)
        spell = SINGING_SONG_ID(caster_ptr);
        s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
 
-       need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
+       need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
        need_mana_frac = 0;
 
        /* Divide by 2 */
@@ -1262,6 +1265,7 @@ static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
        return (&p_ptr->inventory_list[choices[randint0(number)]]);
 }
 
+
 static void process_world_aux_digestion(player_type *creature_ptr)
 {
        if (!creature_ptr->phase_out)
@@ -2248,7 +2252,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
 
                flush();
                msg_print(NULL);
-               (void)get_hack_dir(&dire);
+               (void)get_hack_dir(creature_ptr, &dire);
                fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
        }
 
@@ -2303,7 +2307,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                disturb(creature_ptr, FALSE, TRUE);
                msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
 
-               banish_monsters(100);
+               banish_monsters(creature_ptr, 100);
                if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
                {
                        int n;
@@ -2358,7 +2362,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                 * Unlite the area (radius 10) around player and
                 * do 50 points damage to every affected monster
                 */
-               unlite_area(50, 10);
+               unlite_area(creature_ptr, 50, 10);
        }
 
        if ((creature_ptr->muta2 & MUT2_ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000))
@@ -2579,7 +2583,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                if (slot && !object_is_cursed(o_ptr))
                {
                        msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
-                       inven_drop(slot, 1);
+                       drop_from_inventory(creature_ptr, slot, 1);
                }
        }
 
@@ -2903,9 +2907,9 @@ static void process_world_aux_recharge(player_type *creature_ptr)
        }
 
        /* Process objects on floor */
-       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
+       for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
        {
-               object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
+               object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
 
                if (!OBJECT_IS_VALID(o_ptr)) continue;
 
@@ -2939,7 +2943,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                 * he loads the autosaved game.
                 */
                if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
-                       do_cmd_save_game(TRUE);
+                       do_cmd_save_game(creature_ptr, TRUE);
 
                /* Count down towards recall */
                creature_ptr->word_recall--;
@@ -2964,7 +2968,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                                floor_ptr->dun_level = 0;
                                creature_ptr->dungeon_idx = 0;
 
-                               leave_quest_check();
+                               leave_quest_check(creature_ptr);
                                leave_tower_check();
 
                                creature_ptr->current_floor_ptr->inside_quest = 0;
@@ -3018,7 +3022,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                                 * Clear all saved floors
                                 * and create a first saved floor
                                 */
-                               prepare_change_floor_mode(CFM_FIRST_FLOOR);
+                               prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
                                creature_ptr->leaving = TRUE;
 
                                if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
@@ -3053,7 +3057,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
        if (creature_ptr->alter_reality)
        {
                if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
-                       do_cmd_save_game(TRUE);
+                       do_cmd_save_game(creature_ptr, TRUE);
 
                /* Count down towards alter */
                creature_ptr->alter_reality--;
@@ -3075,7 +3079,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                                 * Clear all saved floors
                                 * and create a first saved floor
                                 */
-                               prepare_change_floor_mode(CFM_FIRST_FLOOR);
+                               prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
                                creature_ptr->leaving = TRUE;
                        }
                        else
@@ -3111,7 +3115,7 @@ static void process_world(player_type *player_ptr)
        {
                player_ptr->current_floor_ptr->dun_level = 0;
                player_ptr->dungeon_idx = 0;
-               prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
+               prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR | CFM_RAND_PLACE);
                player_ptr->current_floor_ptr->inside_arena = FALSE;
                player_ptr->wild_mode = FALSE;
                player_ptr->leaving = TRUE;
@@ -3186,7 +3190,7 @@ static void process_world(player_type *player_ptr)
        if (autosave_t && autosave_freq && !player_ptr->phase_out)
        {
                if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
-                       do_cmd_save_game(TRUE);
+                       do_cmd_save_game(player_ptr, TRUE);
        }
 
        if (player_ptr->current_floor_ptr->monster_noise && !ignore_unview)
@@ -3512,6 +3516,7 @@ static void process_command(player_type *creature_ptr)
                creature_ptr->reset_concent = TRUE;
 
        /* Parse the command */
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
        switch (command_cmd)
        {
                /* Ignore */
@@ -3721,7 +3726,7 @@ static void process_command(player_type *creature_ptr)
                /* Enter store */
                case SPECIAL_KEY_STORE:
                {
-                       do_cmd_store();
+                       do_cmd_store(creature_ptr);
                        break;
                }
 
@@ -3735,14 +3740,14 @@ static void process_command(player_type *creature_ptr)
                /* Enter quest level -KMW- */
                case SPECIAL_KEY_QUEST:
                {
-                       do_cmd_quest();
+                       do_cmd_quest(creature_ptr);
                        break;
                }
 
                /* Go up staircase */
                case '<':
                {
-                       if (!creature_ptr->wild_mode && !p_ptr->current_floor_ptr->dun_level && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->current_floor_ptr->inside_quest)
+                       if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
                        {
                                if (vanilla_town) break;
 
@@ -3855,7 +3860,7 @@ static void process_command(player_type *creature_ptr)
                                {
                                        msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
                                }
-                               else if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
+                               else if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
                                {
                                        msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
                                        msg_print(NULL);
@@ -3899,7 +3904,7 @@ static void process_command(player_type *creature_ptr)
                                        else if (creature_ptr->pclass == CLASS_SAMURAI)
                                                do_cmd_hissatsu(creature_ptr);
                                        else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
-                                               do_cmd_cast_learned();
+                                               do_cmd_cast_learned(creature_ptr);
                                        else if (creature_ptr->pclass == CLASS_SMITH)
                                                do_cmd_kaji(creature_ptr, FALSE);
                                        else if (creature_ptr->pclass == CLASS_SNIPER)
@@ -4066,7 +4071,7 @@ static void process_command(player_type *creature_ptr)
                /* Identify symbol */
                case '/':
                {
-                       do_cmd_query_symbol();
+                       do_cmd_query_symbol(creature_ptr);
                        break;
                }
 
@@ -4102,7 +4107,7 @@ static void process_command(player_type *creature_ptr)
 
                case '_':
                {
-                       do_cmd_edit_autopick();
+                       do_cmd_edit_autopick(creature_ptr);
                        break;
                }
 
@@ -4178,7 +4183,7 @@ static void process_command(player_type *creature_ptr)
                /* Show quest status -KMW- */
                case KTRL('Q'):
                {
-                       do_cmd_checkquest();
+                       do_cmd_checkquest(creature_ptr);
                        break;
                }
 
@@ -4195,7 +4200,7 @@ static void process_command(player_type *creature_ptr)
                /* Hack -- Save and don't quit */
                case KTRL('S'):
                {
-                       do_cmd_save_game(FALSE);
+                       do_cmd_save_game(creature_ptr, FALSE);
                        break;
                }
 
@@ -4203,7 +4208,7 @@ static void process_command(player_type *creature_ptr)
 
                case KTRL('T'):
                {
-                       do_cmd_time();
+                       do_cmd_time(creature_ptr);
                        break;
                }
 
@@ -4224,7 +4229,7 @@ static void process_command(player_type *creature_ptr)
 
                case '|':
                {
-                       do_cmd_nikki();
+                       do_cmd_diary(creature_ptr);
                        break;
                }
 
@@ -4245,7 +4250,7 @@ static void process_command(player_type *creature_ptr)
                /* Save "screen dump" */
                case ')':
                {
-                       do_cmd_save_screen();
+                       do_cmd_save_screen(creature_ptr);
                        break;
                }
 
@@ -4304,32 +4309,31 @@ static void process_command(player_type *creature_ptr)
  */
 static void pack_overflow(player_type *owner_ptr)
 {
-       if (owner_ptr->inventory_list[INVEN_PACK].k_idx)
-       {
-               GAME_TEXT o_name[MAX_NLEN];
-               object_type *o_ptr;
+       if (owner_ptr->inventory_list[INVEN_PACK].k_idx == 0) return;
 
-               /* Is auto-destroy done? */
-               update_creature(owner_ptr);
-               if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
+       GAME_TEXT o_name[MAX_NLEN];
+       object_type *o_ptr;
 
-               /* Access the slot to be dropped */
-               o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
+       /* Is auto-destroy done? */
+       update_creature(owner_ptr);
+       if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
 
-               disturb(owner_ptr, FALSE, TRUE);
+       /* Access the slot to be dropped */
+       o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
 
-               /* Warning */
-               msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
-               object_desc(o_name, o_ptr, 0);
+       disturb(owner_ptr, FALSE, TRUE);
 
-               msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
+       /* Warning */
+       msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
+       object_desc(o_name, o_ptr, 0);
 
-               /* Drop it (carefully) near the player */
-               (void)drop_near(o_ptr, 0, owner_ptr->y, owner_ptr->x);
+       msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
 
-               vary_item(INVEN_PACK, -255);
-               handle_stuff();
-       }
+       /* Drop it (carefully) near the player */
+       (void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
+
+       vary_item(owner_ptr, INVEN_PACK, -255);
+       handle_stuff(owner_ptr);
 }
 
 /*!
@@ -4554,7 +4558,7 @@ static void process_player(player_type *creature_ptr)
                        }
                }
 
-               handle_stuff();
+               handle_stuff(creature_ptr);
        }
        
        load = FALSE;
@@ -4619,7 +4623,7 @@ static void process_player(player_type *creature_ptr)
                creature_ptr->counter = FALSE;
                creature_ptr->now_damaged = FALSE;
 
-               handle_stuff();
+               handle_stuff(creature_ptr);
 
                /* Place the cursor on the player */
                move_cursor_relative(creature_ptr->y, creature_ptr->x);
@@ -4698,7 +4702,7 @@ static void process_player(player_type *creature_ptr)
                        command_rep--;
 
                        creature_ptr->redraw |= (PR_STATE);
-                       handle_stuff();
+                       handle_stuff(creature_ptr);
 
                        /* Hack -- Assume messages were seen */
                        msg_flag = FALSE;
@@ -4857,7 +4861,7 @@ static void process_player(player_type *creature_ptr)
                                creature_ptr->timewalk = FALSE;
                                creature_ptr->energy_need = ENERGY_NEED();
 
-                               handle_stuff();
+                               handle_stuff(creature_ptr);
                        }
                }
 
@@ -4975,14 +4979,14 @@ static void dungeon(player_type *player_ptr, bool load_game)
        player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
        player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
 
-       handle_stuff();
+       handle_stuff(player_ptr);
 
        /* Leave "xtra" mode */
        current_world_ptr->character_xtra = FALSE;
 
        player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
        player_ptr->update |= (PU_COMBINE | PU_REORDER);
-       handle_stuff();
+       handle_stuff(player_ptr);
        Term_fresh();
 
        if (quest_num && (is_fixed_quest_idx(quest_num) &&
@@ -5071,7 +5075,7 @@ static void dungeon(player_type *player_ptr, bool load_game)
                process_player(player_ptr);
                process_upkeep_with_speed(player_ptr);
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Hack -- Hilite the player */
                move_cursor_relative(player_ptr->y, player_ptr->x);
@@ -5083,9 +5087,9 @@ static void dungeon(player_type *player_ptr, bool load_game)
                if (!player_ptr->playing || player_ptr->is_dead) break;
 
                /* Process all of the monsters */
-               process_monsters();
+               process_monsters(player_ptr);
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Hack -- Hilite the player */
                move_cursor_relative(player_ptr->y, player_ptr->x);
@@ -5099,7 +5103,7 @@ static void dungeon(player_type *player_ptr, bool load_game)
                /* Process the world */
                process_world(player_ptr);
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Hack -- Hilite the player */
                move_cursor_relative(player_ptr->y, player_ptr->x);
@@ -5216,6 +5220,7 @@ static void load_all_pref_files(void)
        autopick_load_pref(FALSE);
 }
 
+
 /*!
  * @brief 1ゲームプレイの主要ルーチン / Actually play a game
  * @return なし
@@ -5312,10 +5317,10 @@ void play_game(player_type *player_ptr, bool new_game)
                highscore_fd = fd_open(buf, O_RDWR);
 
                /* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
-               process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
+               process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
 
                /* Handle score, show Top scores */
-               success = send_world_score(TRUE);
+               success = send_world_score(player_ptr, TRUE);
 
                if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
                {
@@ -5326,7 +5331,7 @@ void play_game(player_type *player_ptr, bool new_game)
                {
                        player_ptr->wait_report_score = FALSE;
                        top_twenty(player_ptr);
-                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+                       if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
                }
                /* Shut the high score file */
                (void)fd_close(highscore_fd);
@@ -5355,14 +5360,14 @@ void play_game(player_type *player_ptr, bool new_game)
                init_random_seed = TRUE;
 
                /* Initialize the saved floors data */
-               init_saved_floors(FALSE);
+               init_saved_floors(player_ptr, FALSE);
        }
 
        /* Old game is loaded.  But new game is requested. */
        else if (new_game)
        {
                /* Initialize the saved floors data */
-               init_saved_floors(TRUE);
+               init_saved_floors(player_ptr, TRUE);
        }
 
        /* Process old character */
@@ -5479,7 +5484,7 @@ void play_game(player_type *player_ptr, bool new_game)
                        if (player_ptr->is_dead || !player_ptr->y || !player_ptr->x)
                        {
                                /* Initialize the saved floors data */
-                               init_saved_floors(TRUE);
+                               init_saved_floors(player_ptr, TRUE);
 
                                /* Avoid crash */
                                player_ptr->current_floor_ptr->inside_quest = 0;
@@ -5497,9 +5502,9 @@ void play_game(player_type *player_ptr, bool new_game)
        /* Initialize the town-buildings if necessary */
        if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest)
        {
-               process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
+               process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
                init_flags = INIT_ONLY_BUILDINGS;
-               process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
+               process_dungeon_file(player_ptr, "t_info.txt", 0, 0, MAX_HGT, MAX_WID);
                select_floor_music(player_ptr);
        }
 
@@ -5564,7 +5569,7 @@ void play_game(player_type *player_ptr, bool new_game)
 
        player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
        player_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
-       handle_stuff();
+       handle_stuff(player_ptr);
 
        /* Set or clear "rogue_like_commands" if requested */
        if (arg_force_original) rogue_like_commands = FALSE;
@@ -5605,7 +5610,7 @@ void play_game(player_type *player_ptr, bool new_game)
                /* Hack -- prevent "icky" message */
                current_world_ptr->character_xtra = TRUE;
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                current_world_ptr->character_xtra = FALSE;
 
@@ -5647,7 +5652,7 @@ void play_game(player_type *player_ptr, bool new_game)
                                reset_tim_flags(player_ptr);
 
                                /* Leave through the exit */
-                               prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
+                               prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
 
                                /* prepare next floor */
                                leave_floor(player_ptr);
@@ -5670,7 +5675,7 @@ void play_game(player_type *player_ptr, bool new_game)
        }
 
        /* Close stuff */
-       close_game();
+       close_game(player_ptr);
 
        /* Quit */
        quit(NULL);
@@ -5696,6 +5701,7 @@ s32b turn_real(s32b hoge)
        }
 }
 
+
 /*!
  * @brief ターンのオーバーフローに対する対処
  * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
@@ -5741,22 +5747,24 @@ void prevent_turn_overflow(void)
        }
 }
 
+
 /*!
  * @brief ゲーム終了処理 /
  * Close up the current game (player may or may not be dead)
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * <pre>
  * This function is called only from "main.c" and "signals.c".
  * </pre>
  */
-void close_game(void)
+void close_game(player_type *player_ptr)
 {
        char buf[1024];
        bool do_send = TRUE;
 
        /*      concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
-       handle_stuff();
+       handle_stuff(player_ptr);
 
        /* Flush the messages */
        msg_print(NULL);
@@ -5784,41 +5792,41 @@ void close_game(void)
        safe_setuid_drop();
 
        /* Handle death */
-       if (p_ptr->is_dead)
+       if (player_ptr->is_dead)
        {
                /* Handle retirement */
-               if (current_world_ptr->total_winner) kingly(p_ptr);
+               if (current_world_ptr->total_winner) kingly(player_ptr);
 
                /* Save memories */
                if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
                {
-                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+                       if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
                }
                else do_send = FALSE;
 
                /* You are dead */
-               print_tomb();
+               print_tomb(player_ptr);
 
                flush();
 
                /* Show more info */
-               show_info();
+               show_info(player_ptr);
                Term_clear();
 
                if (check_score())
                {
-                       if ((!send_world_score(do_send)))
+                       if ((!send_world_score(player_ptr, do_send)))
                        {
                                if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
                                        (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
                                {
-                                       p_ptr->wait_report_score = TRUE;
-                                       p_ptr->is_dead = FALSE;
-                                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+                                       player_ptr->wait_report_score = TRUE;
+                                       player_ptr->is_dead = FALSE;
+                                       if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
                                }
                        }
-                       if (!p_ptr->wait_report_score)
-                               (void)top_twenty(p_ptr);
+                       if (!player_ptr->wait_report_score)
+                               (void)top_twenty(player_ptr);
                }
                else if (highscore_fd >= 0)
                {
@@ -5834,14 +5842,14 @@ void close_game(void)
        else
        {
                /* Save the game */
-               do_cmd_save_game(FALSE);
+               do_cmd_save_game(player_ptr, FALSE);
 
                /* Prompt for scores */
                prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
                play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
 
                /* Predict score (or ESCAPE) */
-               if (inkey() != ESCAPE) predict_score(p_ptr);
+               if (inkey() != ESCAPE) predict_score(player_ptr);
        }
 
 
@@ -5851,8 +5859,8 @@ void close_game(void)
        /* Forget the high score fd */
        highscore_fd = -1;
 
-       /* Kill all temporal files */
-       clear_saved_floor_files();
+       /* Kill all temporary files */
+       clear_saved_floor_files(player_ptr);
 
        /* Allow suspending now */
        signals_handle_tstp();
@@ -5864,16 +5872,16 @@ void close_game(void)
  * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
  * @return なし
  */
-void handle_stuff(void)
+void handle_stuff(player_type *player_ptr)
 {
-       if (p_ptr->update) update_creature(p_ptr);
-       if (p_ptr->redraw) redraw_stuff(p_ptr);
-       if (p_ptr->window) window_stuff();
+       if (player_ptr->update) update_creature(player_ptr);
+       if (player_ptr->redraw) redraw_stuff(player_ptr);
+       if (player_ptr->window) window_stuff(player_ptr);
 }
 
-void update_output(void)
+
+void update_output(player_type *player_ptr)
 {
-       if (p_ptr->redraw) redraw_stuff(p_ptr);
-       if (p_ptr->window) window_stuff();
+       if (player_ptr->redraw) redraw_stuff(player_ptr);
+       if (player_ptr->window) window_stuff(player_ptr);
 }
-