OSDN Git Service

[Refactor] #38997 floor-save.c のplayer_type *引数が必要な全関数にこれを追加 (コールチェーンが非常に長いので途中経過は省略...
authorHourier <hourier@users.sourceforge.jp>
Sun, 5 Jan 2020 08:35:36 +0000 (17:35 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 5 Jan 2020 08:35:36 +0000 (17:35 +0900)
26 files changed:
src/autopick.c
src/autopick.h
src/bldg.c
src/cmd/cmd-activate.c
src/cmd/cmd-basic.c
src/cmd/cmd-gameoption.c
src/core.c
src/files.c
src/files.h
src/floor-generate.c
src/floor-generate.h
src/floor-save.c
src/floor-save.h
src/load.c
src/load.h
src/main-win.c
src/player-damage.c
src/player-move.c
src/quest.c
src/quest.h
src/save.c
src/save.h
src/spells-floor.c
src/spells3.c
src/trap.c
src/wizard2.c

index cf38250..993207a 100644 (file)
@@ -5971,8 +5971,9 @@ static int analyze_move_key(text_body_type *tb, int skey)
 
 /*
  * In-game editor of Object Auto-picker/Destoryer
+ * @param player_ptr プレーヤーへの参照ポインタ
  */
-void do_cmd_edit_autopick(void)
+void do_cmd_edit_autopick(player_type *player_ptr)
 {
        static int cx_save = 0;
        static int cy_save = 0;
@@ -6014,7 +6015,7 @@ void do_cmd_edit_autopick(void)
        /* Autosave */
        if (current_world_ptr->game_turn > old_autosave_turn + 100L)
        {
-               do_cmd_save_game(TRUE);
+               do_cmd_save_game(player_ptr, TRUE);
                old_autosave_turn = current_world_ptr->game_turn;
        }
 
index e465716..169a367 100644 (file)
@@ -36,4 +36,4 @@ extern void autopick_alter_item(INVENTORY_IDX item, bool destroy);
 extern void autopick_delayed_alter(void);
 extern void autopick_pickup_items(grid_type *g_ptr);
 extern bool autopick_autoregister(object_type *o_ptr);
-extern void do_cmd_edit_autopick(void);
+extern void do_cmd_edit_autopick(player_type *player_ptr);
index 320ee72..d857b66 100644 (file)
@@ -312,19 +312,19 @@ static void show_building(building_type* bldg)
 
 /*!
  * @brief 闘技場に入るコマンドの処理 / arena commands
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param cmd 闘技場処理のID
  * @return なし
  */
-static void arena_comm(int cmd)
+static void arena_comm(player_type *player_ptr, int cmd)
 {
        monster_race    *r_ptr;
        concptr            name;
-
-
+       
        switch (cmd)
        {
                case BACT_ARENA:
-                       if (p_ptr->arena_number == MAX_ARENA_MONS)
+                       if (player_ptr->arena_number == MAX_ARENA_MONS)
                        {
                                clear_bldg(5, 19);
                                prt(_("アリーナの優勝者!", "               Arena Victor!"), 5, 0);
@@ -333,14 +333,14 @@ static void arena_comm(int cmd)
 
                                prt("", 10, 0);
                                prt("", 11, 0);
-                               p_ptr->au += 1000000L;
+                               player_ptr->au += 1000000L;
                                msg_print(_("スペースキーで続行", "Press the space bar to continue"));
                                msg_print(NULL);
-                               p_ptr->arena_number++;
+                               player_ptr->arena_number++;
                        }
-                       else if (p_ptr->arena_number > MAX_ARENA_MONS)
+                       else if (player_ptr->arena_number > MAX_ARENA_MONS)
                        {
-                               if (p_ptr->arena_number < MAX_ARENA_MONS+2)
+                               if (player_ptr->arena_number < MAX_ARENA_MONS+2)
                                {
                                        msg_print(_("君のために最強の挑戦者を用意しておいた。", "The strongest challenger is waiting for you."));
                                        msg_print(NULL);
@@ -349,15 +349,15 @@ static void arena_comm(int cmd)
                                                msg_print(_("死ぬがよい。", "Die, maggots."));
                                                msg_print(NULL);
                                        
-                                               p_ptr->exit_bldg = FALSE;
-                                               reset_tim_flags(p_ptr);
+                                               player_ptr->exit_bldg = FALSE;
+                                               reset_tim_flags(player_ptr);
 
                                                /* Save the surface floor as saved floor */
-                                               prepare_change_floor_mode(CFM_SAVE_FLOORS);
+                                               prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS);
 
-                                               p_ptr->current_floor_ptr->inside_arena = TRUE;
-                                               p_ptr->leaving = TRUE;
-                                               p_ptr->leave_bldg = TRUE;
+                                               player_ptr->current_floor_ptr->inside_arena = TRUE;
+                                               player_ptr->leaving = TRUE;
+                                               player_ptr->leave_bldg = TRUE;
                                        }
                                        else
                                        {
@@ -371,7 +371,7 @@ static void arena_comm(int cmd)
                                        msg_print(NULL);
                                }
                        }
-                       else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
+                       else if (player_ptr->riding && (player_ptr->pclass != CLASS_BEASTMASTER) && (player_ptr->pclass != CLASS_CAVALRY))
                        {
                                msg_print(_("ペットに乗ったままではアリーナへ入れさせてもらえなかった。",
                                                        "You don't have permission to enter with pet."));
@@ -379,34 +379,34 @@ static void arena_comm(int cmd)
                        }
                        else
                        {
-                               p_ptr->exit_bldg = FALSE;
-                               reset_tim_flags(p_ptr);
+                               player_ptr->exit_bldg = FALSE;
+                               reset_tim_flags(player_ptr);
 
                                /* Save the surface floor as saved floor */
-                               prepare_change_floor_mode(CFM_SAVE_FLOORS);
+                               prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS);
 
-                               p_ptr->current_floor_ptr->inside_arena = TRUE;
-                               p_ptr->leaving = TRUE;
-                               p_ptr->leave_bldg = TRUE;
+                               player_ptr->current_floor_ptr->inside_arena = TRUE;
+                               player_ptr->leaving = TRUE;
+                               player_ptr->leave_bldg = TRUE;
                        }
                        break;
                case BACT_POSTER:
-                       if (p_ptr->arena_number == MAX_ARENA_MONS)
+                       if (player_ptr->arena_number == MAX_ARENA_MONS)
                                msg_print(_("あなたは勝利者だ。 アリーナでのセレモニーに参加しなさい。",
                                                        "You are victorious. Enter the arena for the ceremony."));
 
-                       else if (p_ptr->arena_number > MAX_ARENA_MONS)
+                       else if (player_ptr->arena_number > MAX_ARENA_MONS)
                        {
                                msg_print(_("あなたはすべての敵に勝利した。", "You have won against all foes."));
                        }
                        else
                        {
-                               r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
+                               r_ptr = &r_info[arena_info[player_ptr->arena_number].r_idx];
                                name = (r_name + r_ptr->name);
                                msg_format(_("%s に挑戦するものはいないか?", "Do I hear any challenges against: %s"), name);
 
-                               p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx;
-                               p_ptr->window |= (PW_MONSTER);
+                               player_ptr->monster_race_idx = arena_info[player_ptr->arena_number].r_idx;
+                               player_ptr->window |= (PW_MONSTER);
                                handle_stuff();
 
                        }
@@ -422,6 +422,7 @@ static void arena_comm(int cmd)
        }
 }
 
+
 /*!
  * @brief カジノのスロットシンボルを表示する / display fruit for dice slots
  * @param row シンボルを表示する行の上端
@@ -1547,9 +1548,10 @@ void update_gambling_monsters(void)
 
 /*!
  * @brief モンスター闘技場のメインルーチン
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return 賭けを開始したか否か
  */
-static bool kakutoujou(void)
+static bool kakutoujou(player_type *player_ptr)
 {
        PRICE maxbet;
        PRICE wager;
@@ -1565,7 +1567,7 @@ static bool kakutoujou(void)
        screen_save();
 
        /* No money */
-       if (p_ptr->au < 1)
+       if (player_ptr->au < 1)
        {
                msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!", "Hey! You don't have gold - get out of here!"));
                msg_print(NULL);
@@ -1614,10 +1616,10 @@ static bool kakutoujou(void)
                for (i = 0; i < 4; i++)
                        if (i != sel_monster) clear_bldg(i + 5, i + 5);
 
-               maxbet = p_ptr->lev * 200;
+               maxbet = player_ptr->lev * 200;
 
                /* We can't bet more than we have */
-               maxbet = MIN(maxbet, p_ptr->au);
+               maxbet = MIN(maxbet, player_ptr->au);
 
                /* Get the wager */
                strcpy(out_val, "");
@@ -1634,7 +1636,7 @@ static bool kakutoujou(void)
                        /* Get the wager */
                        wager = atol(p);
 
-                       if (wager > p_ptr->au)
+                       if (wager > player_ptr->au)
                        {
                                msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
 
@@ -1656,15 +1658,15 @@ static bool kakutoujou(void)
                        msg_print(NULL);
                        battle_odds = MAX(wager+1, wager * battle_odds / 100);
                        kakekin = wager;
-                       p_ptr->au -= wager;
-                       reset_tim_flags(p_ptr);
+                       player_ptr->au -= wager;
+                       reset_tim_flags(player_ptr);
 
                        /* Save the surface floor as saved floor */
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS);
+                       prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS);
 
-                       p_ptr->phase_out = TRUE;
-                       p_ptr->leaving = TRUE;
-                       p_ptr->leave_bldg = TRUE;
+                       player_ptr->phase_out = TRUE;
+                       player_ptr->leaving = TRUE;
+                       player_ptr->leave_bldg = TRUE;
 
                        screen_load();
 
@@ -3907,7 +3909,7 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i
        case BACT_POSTER:
        case BACT_ARENA_RULES:
        case BACT_ARENA:
-               arena_comm(bact);
+               arena_comm(player_ptr, bact);
                break;
        case BACT_IN_BETWEEN:
        case BACT_CRAPS:
@@ -3994,7 +3996,7 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i
                break;
 
        case BACT_BATTLE:
-               kakutoujou();
+               kakutoujou(player_ptr);
                break;
 
        case BACT_TSUCHINOKO:
@@ -4097,7 +4099,7 @@ void do_cmd_bldg(player_type *player_ptr)
                else
                {
                        /* Don't save the arena as saved floor */
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
+                       prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_NO_RETURN);
 
                        player_ptr->current_floor_ptr->inside_arena = FALSE;
                        player_ptr->leaving = TRUE;
@@ -4114,7 +4116,7 @@ void do_cmd_bldg(player_type *player_ptr)
        else if (player_ptr->phase_out)
        {
                /* Don't save the arena as saved floor */
-               prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
+               prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_NO_RETURN);
 
                player_ptr->leaving = TRUE;
                player_ptr->phase_out = FALSE;
index 953b853..d3fb307 100644 (file)
@@ -1619,7 +1619,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                default:
                        if (get_check(_("この階を去りますか?", "Leave this level? ")))
                        {
-                               if (autosave_l) do_cmd_save_game(TRUE);
+                               if (autosave_l) do_cmd_save_game(user_ptr, TRUE);
                                user_ptr->leaving = TRUE;
                        }
                }
index 29193a0..0e45af8 100644 (file)
@@ -218,7 +218,7 @@ void do_cmd_go_up(player_type *creature_ptr)
                else
                        msg_print(_("上の階に登った。", "You enter the up staircase."));
 
-               leave_quest_check();
+               leave_quest_check(creature_ptr);
 
                creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
 
@@ -262,13 +262,13 @@ void do_cmd_go_up(player_type *creature_ptr)
 
        take_turn(creature_ptr, 100);
 
-       if (autosave_l) do_cmd_save_game(TRUE);
+       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
        /* For a random quest */
        if (creature_ptr->current_floor_ptr->inside_quest &&
            quest[creature_ptr->current_floor_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
        {
-               leave_quest_check();
+               leave_quest_check(creature_ptr);
 
                creature_ptr->current_floor_ptr->inside_quest = 0;
        }
@@ -277,7 +277,7 @@ void do_cmd_go_up(player_type *creature_ptr)
        if (creature_ptr->current_floor_ptr->inside_quest &&
            quest[creature_ptr->current_floor_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
        {
-               leave_quest_check();
+               leave_quest_check(creature_ptr);
 
                creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
                creature_ptr->current_floor_ptr->dun_level = 0;
@@ -291,14 +291,14 @@ void do_cmd_go_up(player_type *creature_ptr)
                if (have_flag(f_ptr->flags, FF_SHAFT))
                {
                        /* Create a way back */
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
+                       prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
 
                        up_num = 2;
                }
                else
                {
                        /* Create a way back */
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP);
+                       prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_UP);
 
                        up_num = 1;
                }
@@ -350,7 +350,7 @@ void do_cmd_go_down(player_type *creature_ptr)
        /* Quest entrance */
        if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
        {
-               do_cmd_quest();
+               do_cmd_quest(creature_ptr);
        }
 
        /* Quest down stairs */
@@ -364,7 +364,7 @@ void do_cmd_go_down(player_type *creature_ptr)
                else
                        msg_print(_("下の階に降りた。", "You enter the down staircase."));
 
-               leave_quest_check();
+               leave_quest_check(creature_ptr);
                leave_tower_check();
 
                creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
@@ -421,12 +421,12 @@ void do_cmd_go_down(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);
                }
 
                take_turn(creature_ptr, 100);
 
-               if (autosave_l) do_cmd_save_game(TRUE);
+               if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
                /* Go down */
                if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
@@ -469,19 +469,19 @@ void do_cmd_go_down(player_type *creature_ptr)
 
                if (fall_trap)
                {
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+                       prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
                }
                else
                {
                        if (have_flag(f_ptr->flags, FF_SHAFT))
                        {
                                /* Create a way back */
-                               prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
+                               prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
                        }
                        else
                        {
                                /* Create a way back */
-                               prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN);
+                               prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN);
                        }
                }
        }
index df1af10..7a05814 100644 (file)
@@ -1353,7 +1353,7 @@ void do_cmd_options(void)
                case 'P':
                case 'p':
                {
-                       do_cmd_edit_autopick();
+                       do_cmd_edit_autopick(p_ptr);
                        break;
                }
 
index 002e8df..6111654 100644 (file)
@@ -663,12 +663,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 +679,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;
 }
 
@@ -2939,7 +2939,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 +2964,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 +3018,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 +3053,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 +3075,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 +3111,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 +3186,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)
@@ -3735,7 +3735,7 @@ 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;
                }
 
@@ -4102,7 +4102,7 @@ static void process_command(player_type *creature_ptr)
 
                case '_':
                {
-                       do_cmd_edit_autopick();
+                       do_cmd_edit_autopick(creature_ptr);
                        break;
                }
 
@@ -4195,7 +4195,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;
                }
 
@@ -5326,7 +5326,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 +5355,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 +5479,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;
@@ -5647,7 +5647,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);
@@ -5793,7 +5793,7 @@ void close_game(player_type *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;
 
@@ -5815,7 +5815,7 @@ void close_game(player_type *player_ptr)
                                {
                                        player_ptr->wait_report_score = TRUE;
                                        player_ptr->is_dead = FALSE;
-                                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+                                       if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
                                }
                        }
                        if (!player_ptr->wait_report_score)
@@ -5835,7 +5835,7 @@ void close_game(player_type *player_ptr)
        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);
@@ -5853,7 +5853,7 @@ void close_game(player_type *player_ptr)
        highscore_fd = -1;
 
        /* Kill all temporal files */
-       clear_saved_floor_files();
+       clear_saved_floor_files(player_ptr);
 
        /* Allow suspending now */
        signals_handle_tstp();
index edfb032..43b7fb8 100644 (file)
@@ -5964,11 +5964,12 @@ void get_name(player_type *creature_ptr)
 /*!
  * @brief セーブするコマンドのメインルーチン
  * Save the game
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param is_autosave オートセーブ中の処理ならばTRUE
  * @return なし
  * @details
  */
-void do_cmd_save_game(int is_autosave)
+void do_cmd_save_game(player_type *creature_ptr, int is_autosave)
 {
        /* Autosaves do not disturb */
        if (is_autosave)
@@ -5995,7 +5996,7 @@ void do_cmd_save_game(int is_autosave)
        signals_ignore_tstp();
 
        /* Save the player */
-       if (save_player())
+       if (save_player(creature_ptr))
        {
                prt(_("ゲームをセーブしています... 終了", "Saving game... done."), 0, 0);
        }
@@ -6494,6 +6495,7 @@ void show_info(player_type *creature_ptr)
 /*!
  * @brief 異常発生時のゲーム緊急終了処理 /
  * Handle abrupt death of the visual system
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * <pre>
@@ -6503,7 +6505,7 @@ void show_info(player_type *creature_ptr)
  * save file so that player can see tombstone when restart.
  * </pre>
  */
-void exit_game_panic(void)
+void exit_game_panic(player_type *creature_ptr)
 {
        /* If nothing important has happened, just quit */
        if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(_("緊急事態", "panic"));
@@ -6530,7 +6532,7 @@ void exit_game_panic(void)
        (void)strcpy(p_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
 
        /* Panic save, or get worried */
-       if (!save_player()) quit(_("緊急セーブ失敗!", "panic save failed!"));
+       if (!save_player(creature_ptr)) quit(_("緊急セーブ失敗!", "panic save failed!"));
 
        /* Successful panic save */
        quit(_("緊急セーブ成功!", "panic save succeeded!"));
@@ -7053,7 +7055,7 @@ static void handle_signal_abort(int sig)
        signals_ignore_tstp();
 
        /* Attempt to save */
-       if (save_player())
+       if (save_player(p_ptr))
        {
                Term_putstr(45, hgt - 1, -1, TERM_RED, _("緊急セーブ成功!", "Panic save succeeded!"));
        }
index 0820462..733eb9a 100644 (file)
@@ -43,9 +43,9 @@ extern bool show_file(bool show_version, concptr name, concptr what, int line, B
 extern void do_cmd_help(void);
 extern void process_player_name(bool sf);
 extern void get_name(player_type *creature_ptr);
-extern void do_cmd_save_game(int is_autosave);
+extern void do_cmd_save_game(player_type *creature_ptr, int is_autosave);
 extern void do_cmd_save_and_exit(void);
-extern void exit_game_panic(void);
+extern void exit_game_panic(player_type *creature_ptr);
 extern void signals_ignore_tstp(void);
 extern void signals_handle_tstp(void);
 extern void signals_init(void);
index 6e95df1..e360e5a 100644 (file)
@@ -1341,14 +1341,16 @@ void wipe_generate_random_floor_flags(floor_type *floor_ptr)
 
 /*!
  * @brief フロアの全情報を初期化する / Clear and empty floor.
+ * @parama player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-void clear_cave(floor_type *floor_ptr)
+void clear_cave(player_type *player_ptr)
 {
        POSITION x, y;
        int i;
 
        /* Very simplified version of wipe_o_list() */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        (void)C_WIPE(floor_ptr->o_list, floor_ptr->o_max, object_type);
        floor_ptr->o_max = 1;
        floor_ptr->o_cnt = 0;
@@ -1362,7 +1364,7 @@ void clear_cave(floor_type *floor_ptr)
        for (i = 0; i < MAX_MTIMED; i++) floor_ptr->mproc_max[i] = 0;
 
        /* Pre-calc cur_num of pets in party_mon[] */
-       precalc_cur_num_of_pet();
+       precalc_cur_num_of_pet(player_ptr);
 
 
        /* Start with a blank floor_ptr->grid_array */
@@ -1396,14 +1398,16 @@ void clear_cave(floor_type *floor_ptr)
 
 /*!
  * ダンジョンのランダムフロアを生成する / Generates a random dungeon level -RAK-
+ * @parama player_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @note Hack -- regenerate any "overflow" levels
  */
-void generate_floor(floor_type *floor_ptr)
+void generate_floor(player_type *player_ptr)
 {
        int num;
 
        /* Fill the arrays of floors and walls in the good proportions */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        set_floor_and_wall(floor_ptr->dungeon_idx);
 
        /* Generate */
@@ -1412,7 +1416,7 @@ void generate_floor(floor_type *floor_ptr)
                bool okay = TRUE;
                concptr why = NULL;
 
-               clear_cave(floor_ptr);
+               clear_cave(player_ptr);
 
                /* Mega-Hack -- no player yet */
                p_ptr->x = p_ptr->y = 0;
index 99b802c..7c9b764 100644 (file)
@@ -102,8 +102,8 @@ extern dun_data *dun;
 
 extern bool place_quest_monsters(floor_type *floor_ptr, player_type *creature_ptr);
 extern void wipe_generate_random_floor_flags(floor_type *floor_ptr);
-extern void clear_cave(floor_type *floor_ptr);
-extern void generate_floor(floor_type *floor_ptr);
+extern void clear_cave(player_type *player_ptr);
+extern void generate_floor(player_type *player_ptr);
 
 extern bool build_tunnel(floor_type *floor_ptr, POSITION row1, POSITION col1, POSITION row2, POSITION col2);
 extern bool build_tunnel2(floor_type *floor_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, int cutoff);
index d6e89fe..4311e58 100644 (file)
 
 #include "view-mainwindow.h"
 
-
 static FLOOR_IDX new_floor_id;  /*!<次のフロアのID / floor_id of the destination */
 static u32b latest_visit_mark;  /*!<フロアを渡った回数?(確認中) / Max number of visit_mark */
+#define MAX_PARTY_MON 21 /*!< フロア移動時に先のフロアに連れて行けるペットの最大数 Maximum number of preservable pets */
+static monster_type party_mon[MAX_PARTY_MON]; /*!< フロア移動に保存するペットモンスターの配列 */
 
 /*
  * Number of floor_id used from birth
@@ -62,11 +63,12 @@ u32b saved_floor_file_sign;
 
 /*!
  * @brief 保存フロア配列を初期化する / Initialize saved_floors array. 
- * @param force テンポラリファイルが残っていた場合も警告なしで強制的に削除する。
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param force テンポラリファイルが残っていた場合も警告なしで強制的に削除するフラグ
  * @details Make sure that old temporal files are not remaining as gurbages.
  * @return なし
  */
-void init_saved_floors(bool force)
+void init_saved_floors(player_type *creature_ptr, bool force)
 {
        char floor_savefile[1024];
        int i;
@@ -141,7 +143,7 @@ void init_saved_floors(bool force)
        new_floor_id = 0;
 
        /* No change floor mode yet */
-       p_ptr->change_floor_mode = 0;
+       creature_ptr->change_floor_mode = 0;
 
 #ifdef SET_UID
 # ifdef SECURE
@@ -154,9 +156,10 @@ void init_saved_floors(bool force)
 /*!
  * @brief 保存フロア用テンポラリファイルを削除する / Kill temporal files
  * @details Should be called just before the game quit.
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-void clear_saved_floor_files(void)
+void clear_saved_floor_files(player_type *creature_ptr)
 {
        char floor_savefile[1024];
        int i;
@@ -174,7 +177,7 @@ void clear_saved_floor_files(void)
 
                /* No temporal file */
                if (!sf_ptr->floor_id) continue;
-               if (sf_ptr->floor_id == p_ptr->floor_id) continue;
+               if (sf_ptr->floor_id == creature_ptr->floor_id) continue;
 
                /* File name */
                sprintf(floor_savefile, "%s.F%02d", savefile, i);
@@ -223,10 +226,11 @@ saved_floor_type *get_sf_ptr(FLOOR_IDX floor_id)
 
 /*!
  * @brief 参照ポインタ先の保存フロアを抹消する / kill a saved floor and get an empty space
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param sf_ptr 保存フロアの参照ポインタ
  * @return なし
  */
-static void kill_saved_floor(saved_floor_type *sf_ptr)
+static void kill_saved_floor(player_type *creature_ptr, saved_floor_type *sf_ptr)
 {
        char floor_savefile[1024];
        if (!sf_ptr) return;
@@ -234,10 +238,10 @@ static void kill_saved_floor(saved_floor_type *sf_ptr)
        /* Already empty */
        if (!sf_ptr->floor_id) return;
 
-       if (sf_ptr->floor_id == p_ptr->floor_id)
+       if (sf_ptr->floor_id == creature_ptr->floor_id)
        {
                /* Kill current floor */
-               p_ptr->floor_id = 0;
+               creature_ptr->floor_id = 0;
 
                /* Current floor doesn't have temporal file */
        }
@@ -263,11 +267,12 @@ static void kill_saved_floor(saved_floor_type *sf_ptr)
 
 /*!
  * @brief 新規に利用可能な保存フロアを返す / Initialize new saved floor and get its floor id.
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return 利用可能な保存フロアID
  * @details
  * If number of saved floors are already MAX_SAVED_FLOORS, kill the oldest one.
  */
-FLOOR_IDX get_new_floor_id(void)
+FLOOR_IDX get_new_floor_id(player_type *creature_ptr)
 {
        saved_floor_type *sf_ptr = NULL;
        FLOOR_IDX i;
@@ -292,7 +297,7 @@ FLOOR_IDX get_new_floor_id(void)
                        sf_ptr = &saved_floors[i];
 
                        /* Don't kill current floor */
-                       if (sf_ptr->floor_id == p_ptr->floor_id) continue;
+                       if (sf_ptr->floor_id == creature_ptr->floor_id) continue;
 
                        /* Don't kill newer */
                        if (sf_ptr->visit_mark > oldest_visit) continue;
@@ -303,7 +308,7 @@ FLOOR_IDX get_new_floor_id(void)
 
                /* Kill oldest saved floor */
                sf_ptr = &saved_floors[oldest];
-               kill_saved_floor(sf_ptr);
+               kill_saved_floor(creature_ptr, sf_ptr);
 
                /* Use it */
                i = oldest;
@@ -318,7 +323,7 @@ FLOOR_IDX get_new_floor_id(void)
        sf_ptr->visit_mark = latest_visit_mark++;
 
        /* sf_ptr->dun_level may be changed later */
-       sf_ptr->dun_level = p_ptr->current_floor_ptr->dun_level;
+       sf_ptr->dun_level = creature_ptr->current_floor_ptr->dun_level;
 
 
        /* Increment number of floor_id */
@@ -333,34 +338,34 @@ FLOOR_IDX get_new_floor_id(void)
 
 /*!
  * @brief フロア切り替え時の処理フラグを追加する / Prepare mode flags of changing floor
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param mode 追加したい所持フラグ
  * @return なし
  */
-void prepare_change_floor_mode(BIT_FLAGS mode)
+void prepare_change_floor_mode(player_type *creature_ptr, BIT_FLAGS mode)
 {
-       p_ptr->change_floor_mode |= mode;
+       creature_ptr->change_floor_mode |= mode;
 }
 
 /*!
  * @brief 階段移動先のフロアが生成できない時に簡単な行き止まりマップを作成する / Builds the dead end
  * @return なし
  */
-static void build_dead_end(floor_type *floor_ptr)
+static void build_dead_end(player_type *creature_ptr)
 {
        POSITION x, y;
 
-       clear_cave(floor_ptr);
+       clear_cave(creature_ptr);
 
        /* Mega-Hack -- no player yet */
-       p_ptr->x = p_ptr->y = 0;
-
+       creature_ptr->x = creature_ptr->y = 0;
 
        /* Fill the arrays of floors and walls in the good proportions */
        set_floor_and_wall(0);
 
        /* Smallest area */
-       floor_ptr->height = SCREEN_HGT;
-       floor_ptr->width = SCREEN_WID;
+       creature_ptr->current_floor_ptr->height = SCREEN_HGT;
+       creature_ptr->current_floor_ptr->width = SCREEN_WID;
 
        /* Filled with permanent walls */
        for (y = 0; y < MAX_HGT; y++)
@@ -368,27 +373,24 @@ static void build_dead_end(floor_type *floor_ptr)
                for (x = 0; x < MAX_WID; x++)
                {
                        /* Create "solid" perma-wall */
-                       place_solid_perm_bold(floor_ptr, y, x);
+                       place_solid_perm_bold(creature_ptr->current_floor_ptr, y, x);
                }
        }
 
        /* Place at center of the floor */
-       p_ptr->y = floor_ptr->height / 2;
-       p_ptr->x = floor_ptr->width / 2;
+       creature_ptr->y = creature_ptr->current_floor_ptr->height / 2;
+       creature_ptr->x = creature_ptr->current_floor_ptr->width / 2;
 
        /* Give one square */
-       place_floor_bold(floor_ptr, p_ptr->y, p_ptr->x);
+       place_floor_bold(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x);
 
-       wipe_generate_random_floor_flags(floor_ptr);
+       wipe_generate_random_floor_flags(creature_ptr->current_floor_ptr);
 }
 
 
-
-#define MAX_PARTY_MON 21 /*!< フロア移動時に先のフロアに連れて行けるペットの最大数 Maximum number of preservable pets */
-static monster_type party_mon[MAX_PARTY_MON]; /*!< フロア移動に保存するペットモンスターの配列 */
-
 /*!
  * @brief フロア移動時のペット保存処理 / Preserve_pets
+ * @param master_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 static void preserve_pet(player_type *master_ptr)
@@ -518,15 +520,16 @@ static void preserve_pet(player_type *master_ptr)
 
 /*!
  * @brief フロア移動時にペットを伴った場合の準備処理 / Pre-calculate the racial counters of preserved pets
+ * @param master_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * To prevent multiple generation of unique monster who is the minion of player
  */
-void precalc_cur_num_of_pet(void)
+void precalc_cur_num_of_pet(player_type *player_ptr)
 {
        monster_type *m_ptr;
        int i;
-       int max_num = p_ptr->wild_mode ? 1 : MAX_PARTY_MON;
+       int max_num = player_ptr->wild_mode ? 1 : MAX_PARTY_MON;
 
        for (i = 0; i < max_num; i++)
        {
@@ -542,6 +545,7 @@ void precalc_cur_num_of_pet(void)
 
 /*!
  * @brief 移動先のフロアに伴ったペットを配置する / Place preserved pet monsters on new floor
+ * @param master_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 static void place_pet(player_type *master_ptr)
@@ -585,10 +589,10 @@ static void place_pet(player_type *master_ptr)
 
                if (m_idx)
                {
-                       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+                       monster_type *m_ptr = &master_ptr->current_floor_ptr->m_list[m_idx];
                        monster_race *r_ptr;
 
-                       p_ptr->current_floor_ptr->grid_array[cy][cx].m_idx = m_idx;
+                       master_ptr->current_floor_ptr->grid_array[cy][cx].m_idx = m_idx;
 
                        m_ptr->r_idx = party_mon[i].r_idx;
 
@@ -619,7 +623,7 @@ static void place_pet(player_type *master_ptr)
                        /* r_ptr->cur_num++; */
 
                        /* Hack -- Count the number of "reproducers" */
-                       if (r_ptr->flags2 & RF2_MULTIPLY) p_ptr->current_floor_ptr->num_repro++;
+                       if (r_ptr->flags2 & RF2_MULTIPLY) master_ptr->current_floor_ptr->num_repro++;
 
                }
                else
@@ -733,7 +737,7 @@ static void get_out_monster(floor_type *floor_ptr, player_type *protected_ptr)
                if (!in_bounds(floor_ptr, ny, nx)) continue;
 
                /* Require "empty" floor space */
-               if (!cave_empty_bold(p_ptr->current_floor_ptr, ny, nx)) continue;
+               if (!cave_empty_bold(protected_ptr->current_floor_ptr, ny, nx)) continue;
 
                /* Hack -- no teleport onto glyph of warding */
                if (is_glyph_grid(&floor_ptr->grid_array[ny][nx])) continue;
@@ -845,7 +849,7 @@ static void locate_connected_stairs(player_type *creature_ptr, floor_type *floor
        else if (!num)
        {
                /* No stairs found! -- No return */
-               prepare_change_floor_mode(CFM_RAND_PLACE | CFM_NO_RETURN);
+               prepare_change_floor_mode(creature_ptr, CFM_RAND_PLACE | CFM_NO_RETURN);
 
                /* Mega Hack -- It's not the stairs you enter.  Disable it.  */
                if (!feat_uses_special(floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat)) floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].special = 0;
@@ -864,6 +868,7 @@ static void locate_connected_stairs(player_type *creature_ptr, floor_type *floor
 /*!
  * @brief 現在のフロアを離れるに伴って行なわれる保存処理
  * / Maintain quest monsters, mark next floor_id at stairs, save current floor, and prepare to enter next floor.
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 void leave_floor(player_type *creature_ptr)
@@ -892,7 +897,7 @@ void leave_floor(player_type *creature_ptr)
            !(creature_ptr->change_floor_mode & CFM_NO_RETURN))
        {
            /* Get temporal floor_id */
-               tmp_floor_idx = get_new_floor_id();
+               tmp_floor_idx = get_new_floor_id(creature_ptr);
        }
 
        /* Search the quest monster index */
@@ -901,7 +906,7 @@ void leave_floor(player_type *creature_ptr)
                if ((quest[i].status == QUEST_STATUS_TAKEN) &&
                    ((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
                    (quest[i].type == QUEST_TYPE_RANDOM)) &&
-                   (quest[i].level == p_ptr->current_floor_ptr->dun_level) &&
+                   (quest[i].level == creature_ptr->current_floor_ptr->dun_level) &&
                    (creature_ptr->dungeon_idx == quest[i].dungeon) &&
                    !(quest[i].flags & QUEST_FLAG_PRESET))
                {
@@ -910,10 +915,10 @@ void leave_floor(player_type *creature_ptr)
        }
 
        /* Maintain quest monsters */
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < creature_ptr->current_floor_ptr->m_max; i++)
        {
                monster_race *r_ptr;
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[i];
 
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -958,7 +963,7 @@ void leave_floor(player_type *creature_ptr)
        if (creature_ptr->change_floor_mode & CFM_SAVE_FLOORS)
        {
                /* Extract stair position */
-               g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
+               g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
                f_ptr = &f_info[g_ptr->feat];
 
                /* Get back to old saved floor? */
@@ -971,7 +976,7 @@ void leave_floor(player_type *creature_ptr)
                /* Mark shaft up/down */
                if (have_flag(f_ptr->flags, FF_STAIRS) && have_flag(f_ptr->flags, FF_SHAFT))
                {
-                       prepare_change_floor_mode(CFM_SHAFT);
+                       prepare_change_floor_mode(creature_ptr, CFM_SHAFT);
                }
        }
 
@@ -991,20 +996,20 @@ void leave_floor(player_type *creature_ptr)
                /* Get out from or Enter the dungeon */
                if (creature_ptr->change_floor_mode & CFM_DOWN)
                {
-                       if (!p_ptr->current_floor_ptr->dun_level)
+                       if (!creature_ptr->current_floor_ptr->dun_level)
                                move_num = d_info[creature_ptr->dungeon_idx].mindepth;
                }
                else if (creature_ptr->change_floor_mode & CFM_UP)
                {
-                       if (p_ptr->current_floor_ptr->dun_level + move_num < d_info[creature_ptr->dungeon_idx].mindepth)
-                               move_num = -p_ptr->current_floor_ptr->dun_level;
+                       if (creature_ptr->current_floor_ptr->dun_level + move_num < d_info[creature_ptr->dungeon_idx].mindepth)
+                               move_num = -creature_ptr->current_floor_ptr->dun_level;
                }
 
-               p_ptr->current_floor_ptr->dun_level += move_num;
+               creature_ptr->current_floor_ptr->dun_level += move_num;
        }
 
        /* Leaving the dungeon to town */
-       if (!p_ptr->current_floor_ptr->dun_level && creature_ptr->dungeon_idx)
+       if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->dungeon_idx)
        {
                creature_ptr->leaving_dungeon = TRUE;
                if (!vanilla_town && !lite_town)
@@ -1024,7 +1029,7 @@ void leave_floor(player_type *creature_ptr)
        {
                /* Kill all saved floors */
                for (i = 0; i < MAX_SAVED_FLOORS; i++)
-                       kill_saved_floor(&saved_floors[i]);
+                       kill_saved_floor(creature_ptr, &saved_floors[i]);
 
                /* Reset visit_mark count */
                latest_visit_mark = 1;
@@ -1032,7 +1037,7 @@ void leave_floor(player_type *creature_ptr)
        else if (creature_ptr->change_floor_mode & CFM_NO_RETURN)
        {
                /* Kill current floor */
-               kill_saved_floor(sf_ptr);
+               kill_saved_floor(creature_ptr, sf_ptr);
        }
 
        /* No current floor -- Left/Enter dungeon etc... */
@@ -1046,7 +1051,7 @@ void leave_floor(player_type *creature_ptr)
        if (!new_floor_id)
        {
                /* Get new id */
-               new_floor_id = get_new_floor_id();
+               new_floor_id = get_new_floor_id(creature_ptr);
 
                /* Connect from here */
                if (g_ptr && !feat_uses_special(g_ptr->feat))
@@ -1069,23 +1074,23 @@ void leave_floor(player_type *creature_ptr)
            !(creature_ptr->change_floor_mode & CFM_NO_RETURN))
        {
                /* Get out of the my way! */
-               get_out_monster(p_ptr->current_floor_ptr, creature_ptr);
+               get_out_monster(creature_ptr->current_floor_ptr, creature_ptr);
 
                /* Record the last visit turn of current floor */
                sf_ptr->last_visit = current_world_ptr->game_turn;
 
-               forget_lite(p_ptr->current_floor_ptr);
-               forget_view(p_ptr->current_floor_ptr);
-               clear_mon_lite(p_ptr->current_floor_ptr);
+               forget_lite(creature_ptr->current_floor_ptr);
+               forget_view(creature_ptr->current_floor_ptr);
+               clear_mon_lite(creature_ptr->current_floor_ptr);
 
                /* Save current floor */
                if (!save_floor(sf_ptr, 0))
                {
                        /* Save failed -- No return */
-                       prepare_change_floor_mode(CFM_NO_RETURN);
+                       prepare_change_floor_mode(creature_ptr, CFM_NO_RETURN);
 
                        /* Kill current floor */
-                       kill_saved_floor(get_sf_ptr(creature_ptr->floor_id));
+                       kill_saved_floor(creature_ptr, get_sf_ptr(creature_ptr->floor_id));
                }
        }
 }
@@ -1093,6 +1098,7 @@ void leave_floor(player_type *creature_ptr)
 
 /*!
  * @brief フロアの切り替え処理 / Enter new floor.
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * If the floor is an old saved floor, it will be\n
@@ -1123,7 +1129,7 @@ void change_floor(player_type *creature_ptr)
        if (!(creature_ptr->change_floor_mode & CFM_SAVE_FLOORS) &&
            !(creature_ptr->change_floor_mode & CFM_FIRST_FLOOR))
        {
-               generate_floor(creature_ptr->current_floor_ptr);
+               generate_floor(creature_ptr);
 
                /* Paranoia -- No new saved floor */
                new_floor_id = 0;
@@ -1136,7 +1142,7 @@ void change_floor(player_type *creature_ptr)
                if (!new_floor_id)
                {
                        /* Get new id */
-                       new_floor_id = get_new_floor_id();
+                       new_floor_id = get_new_floor_id(creature_ptr);
                }
 
                /* Pointer for infomations of new floor */
@@ -1146,7 +1152,7 @@ void change_floor(player_type *creature_ptr)
                if (sf_ptr->last_visit)
                {
                        /* Old saved floor is exist */
-                       if (load_floor(sf_ptr, 0))
+                       if (load_floor(creature_ptr, sf_ptr, 0))
                        {
                                loaded = TRUE;
 
@@ -1300,7 +1306,7 @@ void change_floor(player_type *creature_ptr)
                                msg_print(_("階段は行き止まりだった。", "The staircases come to a dead end..."));
 
                                /* Create simple dead end */
-                               build_dead_end(creature_ptr->current_floor_ptr);
+                               build_dead_end(creature_ptr);
 
                                /* Break connection */
                                if (creature_ptr->change_floor_mode & CFM_UP)
@@ -1314,7 +1320,7 @@ void change_floor(player_type *creature_ptr)
                        }
                        else
                        {
-                               generate_floor(creature_ptr->current_floor_ptr);
+                               generate_floor(creature_ptr);
                        }
 
                        /* Record last visit turn */
index 1c89677..911b0d9 100644 (file)
@@ -18,12 +18,12 @@ typedef struct
 
 extern u32b saved_floor_file_sign;
 
-extern void init_saved_floors(bool force);
+extern void init_saved_floors(player_type *creature_ptr, bool force);
 extern void change_floor(player_type *creature_ptr);
 extern void leave_floor(player_type *creature_ptr);
-extern void clear_saved_floor_files(void);
+extern void clear_saved_floor_files(player_type *creature_ptr);
 extern saved_floor_type *get_sf_ptr(FLOOR_IDX floor_id);
-extern FLOOR_IDX get_new_floor_id(void);
+extern FLOOR_IDX get_new_floor_id(player_type *creature_ptr);
 
 /*
  * Flags for change floor mode
@@ -38,7 +38,7 @@ extern FLOOR_IDX get_new_floor_id(void);
 #define CFM_SAVE_FLOORS  0x0080  /* Save floors */
 #define CFM_NO_RETURN    0x0100  /* Flee from random quest etc... */
 #define CFM_FIRST_FLOOR  0x0200  /* Create exit from the dungeon */
-extern void prepare_change_floor_mode(BIT_FLAGS mode);
+extern void prepare_change_floor_mode(player_type *creature_ptr, BIT_FLAGS mode);
 
-extern void precalc_cur_num_of_pet(void);
+extern void precalc_cur_num_of_pet(player_type *creature_ptr);
 extern FLOOR_IDX max_floor_id;
index 25b0902..9e6a369 100644 (file)
@@ -2964,6 +2964,8 @@ static errr rd_dungeon_old(floor_type *floor_ptr)
 
 /*!
  * @brief 保存されたフロアを読み込む / Read the saved floor
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param sf_ptr 最後に保存されたフロアへの参照ポインタ
  * @return info読み込みエラーコード
  * @details
  * この関数は、セーブデータの互換性を保つために多くのデータ改変処理を備えている。
@@ -2975,7 +2977,7 @@ static errr rd_dungeon_old(floor_type *floor_ptr)
  * The monsters/objects must be loaded in the same order
  * that they were stored, since the actual indexes matter.
  */
-static errr rd_saved_floor(saved_floor_type *sf_ptr, floor_type *floor_ptr)
+static errr rd_saved_floor(player_type *player_ptr, saved_floor_type *sf_ptr)
 {
        POSITION ymax, xmax;
        POSITION y, x;
@@ -2989,11 +2991,11 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr, floor_type *floor_ptr)
        u16b limit;
 
        grid_template_type *templates;
-
-       clear_cave(floor_ptr);
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       clear_cave(player_ptr);
 
        /* Mega-Hack -- no player yet */
-       p_ptr->x = p_ptr->y = 0;
+       player_ptr->x = player_ptr->y = 0;
 
        /*** Basic info ***/
 
@@ -3040,17 +3042,17 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr, floor_type *floor_ptr)
        floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s;
 
        rd_u16b(&tmp16u);
-       p_ptr->y = (POSITION)tmp16u;
+       player_ptr->y = (POSITION)tmp16u;
 
        rd_u16b(&tmp16u);
-       p_ptr->x = (POSITION)tmp16u;
+       player_ptr->x = (POSITION)tmp16u;
 
        rd_s16b(&tmp16s);
        floor_ptr->height = (POSITION)tmp16s;
        rd_s16b(&tmp16s);
        floor_ptr->width = (POSITION)tmp16s;
 
-       rd_byte(&p_ptr->feeling);
+       rd_byte(&player_ptr->feeling);
 
 
 
@@ -3255,12 +3257,13 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr, floor_type *floor_ptr)
 
 /*!
  * @brief 保存されたフロアを読み込む(現版) / Read the dungeon (new method)
- * @return なし
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return エラーコード
  * @details
  * The monsters/objects must be loaded in the same order
  * that they were stored, since the actual indexes matter.
  */
-static errr rd_dungeon(void)
+static errr rd_dungeon(player_type *player_ptr)
 {
        errr err = 0;
        s16b tmp16s;
@@ -3269,18 +3272,18 @@ static errr rd_dungeon(void)
        int i;
 
        /* Initialize saved_floors array and temporal files */
-       init_saved_floors(FALSE);
+       init_saved_floors(player_ptr, FALSE);
 
        /* Older method */
        if (h_older_than(1, 5, 0, 0))
        {
-               err = rd_dungeon_old(p_ptr->current_floor_ptr);
+               err = rd_dungeon_old(player_ptr->current_floor_ptr);
 
                /* Prepare floor_id of current floor */
-               if (p_ptr->dungeon_idx)
+               if (player_ptr->dungeon_idx)
                {
-                       p_ptr->floor_id = get_new_floor_id();
-                       get_sf_ptr(p_ptr->floor_id)->dun_level = p_ptr->current_floor_ptr->dun_level;
+                       player_ptr->floor_id = get_new_floor_id(player_ptr);
+                       get_sf_ptr(player_ptr->floor_id)->dun_level = player_ptr->current_floor_ptr->dun_level;
                }
 
                return err;
@@ -3294,7 +3297,7 @@ static errr rd_dungeon(void)
 
        /* Current dungeon type */
        rd_byte(&tmp8u);
-       p_ptr->dungeon_idx = (DUNGEON_IDX)tmp8u;
+       player_ptr->dungeon_idx = (DUNGEON_IDX)tmp8u;
 
        /* Number of the saved_floors array elements */
        rd_byte(&num);
@@ -3303,7 +3306,7 @@ static errr rd_dungeon(void)
        if (!num)
        {
                /* Read the current floor data */
-               err = rd_saved_floor(NULL, p_ptr->current_floor_ptr);
+               err = rd_saved_floor(player_ptr, NULL);
        }
 
        /*** In the dungeon ***/
@@ -3342,7 +3345,7 @@ static errr rd_dungeon(void)
                        if (tmp8u) continue;
 
                        /* Read from the save file */
-                       err = rd_saved_floor(sf_ptr, p_ptr->current_floor_ptr);
+                       err = rd_saved_floor(player_ptr, sf_ptr);
 
                        /* Error? */
                        if (err) break;
@@ -3357,7 +3360,7 @@ static errr rd_dungeon(void)
                /* Finally load current floor data from temporal file */
                if (!err)
                {
-                       if (!load_floor(get_sf_ptr(p_ptr->floor_id), SLF_SECOND)) err = 183;
+                       if (!load_floor(player_ptr, get_sf_ptr(player_ptr->floor_id), SLF_SECOND)) err = 183;
                }
        }
 
@@ -3929,7 +3932,7 @@ static errr rd_savefile_new_aux(player_type *creature_ptr)
                /* Dead players have no dungeon */
                note(_("ダンジョン復元中...", "Restoring Dungeon..."));
 
-               if (rd_dungeon())
+               if (rd_dungeon(creature_ptr))
                {
                        note(_("ダンジョンデータ読み込み失敗", "Error reading dungeon data"));
                        return (34);
@@ -4024,10 +4027,11 @@ errr rd_savefile_new(void)
 
 /*!
  * @brief 保存フロア読み込みのサブ関数 / Actually load and verify a floor save data
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param sf_ptr 保存フロア読み込み先
  * @return 成功したらtrue
  */
-static bool load_floor_aux(saved_floor_type *sf_ptr)
+static bool load_floor_aux(player_type *player_ptr, saved_floor_type *sf_ptr)
 {
        byte tmp8u;
        u32b tmp32u;
@@ -4057,7 +4061,7 @@ static bool load_floor_aux(saved_floor_type *sf_ptr)
        if (saved_floor_file_sign != tmp32u) return FALSE;
 
        /* Read -- have error? */
-       if (rd_saved_floor(sf_ptr, p_ptr->current_floor_ptr)) return FALSE;
+       if (rd_saved_floor(player_ptr, sf_ptr)) return FALSE;
 
 
 #ifdef VERIFY_CHECKSUMS
@@ -4087,11 +4091,12 @@ static bool load_floor_aux(saved_floor_type *sf_ptr)
 
 /*!
  * @brief 一時保存フロア情報を読み込む / Attempt to load the temporally saved-floor data
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param sf_ptr 保存フロア読み込み先
  * @param mode オプション
  * @return 成功したらtrue
  */
-bool load_floor(saved_floor_type *sf_ptr, BIT_FLAGS mode)
+bool load_floor(player_type *player_ptr, saved_floor_type *sf_ptr, BIT_FLAGS mode)
 {
        FILE *old_fff = NULL;
        byte old_xor_byte = 0;
@@ -4159,7 +4164,7 @@ bool load_floor(saved_floor_type *sf_ptr, BIT_FLAGS mode)
        if (ok)
        {
                /* Load saved floor data from file */
-               ok = load_floor_aux(sf_ptr);
+               ok = load_floor_aux(player_ptr, sf_ptr);
 
                /* Check for errors */
                if (ferror(fff)) ok = FALSE;
index d049c23..9738ddc 100644 (file)
@@ -55,4 +55,4 @@
 
 /* load.c */
 extern errr rd_savefile_new(void);
-extern bool load_floor(saved_floor_type *sf_ptr, BIT_FLAGS mode);
+extern bool load_floor(player_type *player_ptr, saved_floor_type *sf_ptr, BIT_FLAGS mode);
index 431d201..15e116c 100644 (file)
@@ -3915,7 +3915,7 @@ static void process_menus(WORD wCmd)
 
                                /* Save the game */
 #ifdef ZANGBAND
-                               do_cmd_save_game(FALSE);
+                               do_cmd_save_game(p_ptr, FALSE);
 #else /* ZANGBAND */
                                do_cmd_save_game();
 #endif /* ZANGBAND */
@@ -4875,7 +4875,7 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
                                (void)strcpy(p_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
 
                                /* Panic save */
-                               (void)save_player();
+                               (void)save_player(p_ptr);
                        }
                        quit(NULL);
                        return 0;
index d87d6ac..bcf9234 100644 (file)
@@ -486,7 +486,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
 
 #ifdef JP       /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
                if (!cheat_save)
-                       if (!save_player()) msg_print("セーブ失敗!");
+                       if (!save_player(creature_ptr)) msg_print("セーブ失敗!");
 #endif
 
                sound(SOUND_DEATH);
index 7335d8c..f0fc883 100644 (file)
@@ -755,7 +755,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                        complete_quest(creature_ptr->current_floor_ptr->inside_quest);
                }
 
-               leave_quest_check();
+               leave_quest_check(creature_ptr);
 
                creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
                p_ptr->current_floor_ptr->dun_level = 0;
index e7cdae5..dc986fd 100644 (file)
@@ -444,12 +444,13 @@ QUEST_IDX random_quest_number(DEPTH level)
 
 /*!
  * @brief クエスト階層から離脱する際の処理
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-void leave_quest_check(void)
+void leave_quest_check(player_type *player_ptr)
 {
        /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
-       leaving_quest = p_ptr->current_floor_ptr->inside_quest;
+       leaving_quest = player_ptr->current_floor_ptr->inside_quest;
 
        /* Leaving an 'only once' quest marks it as failed */
        if (leaving_quest)
@@ -460,7 +461,7 @@ void leave_quest_check(void)
                        (q_ptr->status == QUEST_STATUS_TAKEN))
                {
                        q_ptr->status = QUEST_STATUS_FAILED;
-                       q_ptr->complev = p_ptr->lev;
+                       q_ptr->complev = player_ptr->lev;
                        update_playtime();
                        q_ptr->comptime = current_world_ptr->play_time;
 
@@ -469,7 +470,7 @@ void leave_quest_check(void)
                        {
                        case QUEST_TYPE_TOWER:
                                quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
-                               quest[QUEST_TOWER1].complev = p_ptr->lev;
+                               quest[QUEST_TOWER1].complev = player_ptr->lev;
                                break;
                        case QUEST_TYPE_FIND_ARTIFACT:
                                a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
@@ -478,18 +479,18 @@ void leave_quest_check(void)
                                r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
 
                                /* Floor of random quest will be blocked */
-                               prepare_change_floor_mode(CFM_NO_RETURN);
+                               prepare_change_floor_mode(player_ptr, CFM_NO_RETURN);
                                break;
                        }
 
                        /* Record finishing a quest */
                        if (q_ptr->type == QUEST_TYPE_RANDOM)
                        {
-                               if (record_rand_quest) exe_write_diary(p_ptr, NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+                               if (record_rand_quest) exe_write_diary(player_ptr, NIKKI_RAND_QUEST_F, leaving_quest, NULL);
                        }
                        else
                        {
-                               if (record_fix_quest) exe_write_diary(p_ptr, NIKKI_FIX_QUEST_F, leaving_quest, NULL);
+                               if (record_fix_quest) exe_write_diary(player_ptr, NIKKI_FIX_QUEST_F, leaving_quest, NULL);
                        }
                }
        }
@@ -520,15 +521,16 @@ void leave_tower_check(void)
 
 /*!
  * @brief クエスト入り口にプレイヤーが乗った際の処理 / Do building commands
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-void do_cmd_quest(void)
+void do_cmd_quest(player_type *player_ptr)
 {
-       if (p_ptr->wild_mode) return;
+       if (player_ptr->wild_mode) return;
 
-       take_turn(p_ptr, 100);
+       take_turn(player_ptr, 100);
 
-       if (!cave_have_flag_bold(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, FF_QUEST_ENTER))
+       if (!cave_have_flag_bold(player_ptr->current_floor_ptr, player_ptr->y, player_ptr->x, FF_QUEST_ENTER))
        {
                msg_print(_("ここにはクエストの入口はない。", "You see no quest level here."));
                return;
@@ -537,20 +539,20 @@ void do_cmd_quest(void)
        {
                msg_print(_("ここにはクエストへの入口があります。", "There is an entry of a quest."));
                if (!get_check(_("クエストに入りますか?", "Do you enter? "))) return;
-               if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+               if ((player_ptr->pseikaku == SEIKAKU_COMBAT) || (player_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
                        msg_print(_("『とにかく入ってみようぜぇ。』", ""));
-               else if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN) msg_print("『全滅してやるぞ!』");
+               else if (player_ptr->pseikaku == SEIKAKU_CHARGEMAN) msg_print("『全滅してやるぞ!』");
 
                /* Player enters a new quest */
-               p_ptr->oldpy = 0;
-               p_ptr->oldpx = 0;
+               player_ptr->oldpy = 0;
+               player_ptr->oldpx = 0;
 
-               leave_quest_check();
+               leave_quest_check(player_ptr);
 
-               if (quest[p_ptr->current_floor_ptr->inside_quest].type != QUEST_TYPE_RANDOM) p_ptr->current_floor_ptr->dun_level = 1;
-               p_ptr->current_floor_ptr->inside_quest = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special;
+               if (quest[player_ptr->current_floor_ptr->inside_quest].type != QUEST_TYPE_RANDOM) player_ptr->current_floor_ptr->dun_level = 1;
+               player_ptr->current_floor_ptr->inside_quest = player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].special;
 
-               p_ptr->leaving = TRUE;
+               player_ptr->leaving = TRUE;
        }
 }
 
index 039c2e2..f951172 100644 (file)
@@ -92,7 +92,7 @@ extern void check_find_art_quest_completion(object_type *o_ptr);
 extern void quest_discovery(QUEST_IDX q_idx);
 extern QUEST_IDX quest_number(DEPTH level);
 extern QUEST_IDX random_quest_number(DEPTH level);
-extern void leave_quest_check(void);
+extern void leave_quest_check(player_type *player_ptr);
 extern void leave_tower_check(void);
-extern void do_cmd_quest(void);
+extern void do_cmd_quest(player_type *player_ptr);
 
index 8e96052..0f17c3d 100644 (file)
@@ -1108,9 +1108,10 @@ static void wr_saved_floor(saved_floor_type *sf_ptr)
 /*!
  * @brief 現在フロアの書き込み /
  * Write the current dungeon (new method)
- * @return なし
+ * @player_ptr プレーヤーへの参照ポインタ
+ * @return 保存に成功したらTRUE
  */
-static bool wr_dungeon(void)
+static bool wr_dungeon(player_type *player_ptr)
 {
        saved_floor_type *cur_sf_ptr;
        int i;
@@ -1180,7 +1181,7 @@ static bool wr_dungeon(void)
                if (!sf_ptr->floor_id) continue;
 
                /* Load temporal saved floor file */
-               if (load_floor(sf_ptr, (SLF_SECOND | SLF_NO_KILL)))
+               if (load_floor(player_ptr, sf_ptr, (SLF_SECOND | SLF_NO_KILL)))
                {
                        /* Mark success */
                        wr_byte(0);
@@ -1196,7 +1197,7 @@ static bool wr_dungeon(void)
        }
 
        /* Restore current floor */
-       if (!load_floor(cur_sf_ptr, (SLF_SECOND))) return FALSE;
+       if (!load_floor(player_ptr, cur_sf_ptr, (SLF_SECOND))) return FALSE;
 
        /* Success */
        return TRUE;
@@ -1206,9 +1207,10 @@ static bool wr_dungeon(void)
 /*!
  * @brief セーブデータの書き込み /
  * Actually write a save-file
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return 成功すればtrue
  */
-static bool wr_savefile_new(void)
+static bool wr_savefile_new(player_type *player_ptr)
 {
        int        i, j;
 
@@ -1477,7 +1479,7 @@ static bool wr_savefile_new(void)
        if (!p_ptr->is_dead)
        {
                /* Dump the dungeon */
-               if (!wr_dungeon()) return FALSE;
+               if (!wr_dungeon(player_ptr)) return FALSE;
 
                /* Dump the ghost */
                wr_ghost();
@@ -1505,11 +1507,12 @@ static bool wr_savefile_new(void)
 /*!
  * @brief セーブデータ書き込みのサブルーチン /
  * Medium level player saver
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return 成功すればtrue
  * @details
  * Angband 2.8.0 will use "fd" instead of "fff" if possible
  */
-static bool save_player_aux(char *name)
+static bool save_player_aux(player_type *player_ptr, char *name)
 {
        bool ok = FALSE;
        int fd = -1;
@@ -1549,7 +1552,7 @@ static bool save_player_aux(char *name)
                if (fff)
                {
                        /* Write the savefile */
-                       if (wr_savefile_new()) ok = TRUE;
+                       if (wr_savefile_new(player_ptr)) ok = TRUE;
 
                        /* Attempt to close it */
                        if (my_fclose(fff)) ok = FALSE;
@@ -1583,9 +1586,10 @@ static bool save_player_aux(char *name)
 /*!
  * @brief セーブデータ書き込みのメインルーチン /
  * Attempt to save the player in a savefile
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return 成功すればtrue
  */
-bool save_player(void)
+bool save_player(player_type *player_ptr)
 {
        bool result = FALSE;
 
@@ -1620,7 +1624,7 @@ bool save_player(void)
        update_playtime();
 
        /* Attempt to save the player */
-       if (save_player_aux(safe))
+       if (save_player_aux(player_ptr, safe))
        {
                char temp[1024];
 
index 388c8e5..c342a82 100644 (file)
@@ -7,8 +7,7 @@
 #define SLF_NO_KILL      0x0002  /* Don't kill temporal files */
 
 /* save.c */
-extern bool save_player(void);
+extern bool save_player(player_type *player_ptr);
 extern bool load_player(void);
 extern void remove_loc(void);
 extern bool save_floor(saved_floor_type *sf_ptr, BIT_FLAGS mode);
-
index 3bd0a80..cad3bab 100644 (file)
@@ -305,7 +305,7 @@ void stair_creation(player_type *caster_ptr)
        if (!sf_ptr)
        {
                /* No floor id? -- Create now! */
-               caster_ptr->floor_id = get_new_floor_id();
+               caster_ptr->floor_id = get_new_floor_id(caster_ptr);
                sf_ptr = get_sf_ptr(caster_ptr->floor_id);
        }
 
@@ -352,7 +352,7 @@ void stair_creation(player_type *caster_ptr)
        /* No old destination -- Get new one now */
        else
        {
-               dest_floor_id = get_new_floor_id();
+               dest_floor_id = get_new_floor_id(caster_ptr);
 
                /* Fix it */
                if (up)
index d2d2cda..f2c0374 100644 (file)
@@ -676,16 +676,16 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx)
 
                        if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
 
-                       if (autosave_l) do_cmd_save_game(TRUE);
+                       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
                        if (!creature_ptr->current_floor_ptr->dun_level)
                        {
                                creature_ptr->current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].mindepth;
-                               prepare_change_floor_mode(CFM_RAND_PLACE);
+                               prepare_change_floor_mode(creature_ptr, CFM_RAND_PLACE);
                        }
                        else
                        {
-                               prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+                               prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
                        }
                        creature_ptr->leaving = TRUE;
                }
@@ -705,11 +705,11 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx)
                {
                        if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
 
-                       if (autosave_l) do_cmd_save_game(TRUE);
+                       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+                       prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
 
-                       leave_quest_check();
+                       leave_quest_check(creature_ptr);
                        creature_ptr->current_floor_ptr->inside_quest = 0;
                        creature_ptr->leaving = TRUE;
                }
@@ -727,9 +727,9 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx)
                {
                        if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
 
-                       if (autosave_l) do_cmd_save_game(TRUE);
+                       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+                       prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
                        creature_ptr->leaving = TRUE;
                }
        }
@@ -746,9 +746,9 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx)
                        /* Never reach this code on the surface */
                        /* if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = creature_ptr->recall_dungeon; */
                        if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
-                       if (autosave_l) do_cmd_save_game(TRUE);
+                       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+                       prepare_change_floor_mode(creature_ptr, CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
                        creature_ptr->leaving = TRUE;
                }
        }
index db3a00a..93acb28 100644 (file)
@@ -441,10 +441,10 @@ void hit_trap(player_type *trapped_ptr, bool break_trap)
 
                        /* Still alive and autosave enabled */
                        if (autosave_l && (trapped_ptr->chp >= 0))
-                               do_cmd_save_game(TRUE);
+                               do_cmd_save_game(trapped_ptr, TRUE);
 
                        exe_write_diary(trapped_ptr, NIKKI_BUNSHOU, 0, _("落とし戸に落ちた", "You have fallen through a trap door!"));
-                       prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+                       prepare_change_floor_mode(trapped_ptr, CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
                        trapped_ptr->leaving = TRUE;
                }
                break;
index 8d53b64..c373649 100644 (file)
@@ -1413,18 +1413,18 @@ static void do_cmd_wiz_jump(player_type *creature_ptr)
        /* Accept request */
        msg_format("You jump 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;
 
-       prepare_change_floor_mode(CFM_RAND_PLACE);
+       prepare_change_floor_mode(creature_ptr, CFM_RAND_PLACE);
 
        if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = 0;
        creature_ptr->current_floor_ptr->inside_arena = FALSE;
        creature_ptr->wild_mode = FALSE;
 
-       leave_quest_check();
+       leave_quest_check(creature_ptr);
 
        if (record_stair) exe_write_diary(creature_ptr, NIKKI_WIZ_TELE, 0, NULL);
 
@@ -1438,7 +1438,7 @@ static void do_cmd_wiz_jump(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;
 }