OSDN Git Service

[Refactor] #37353 player-move.h を追加。 / Add player-move.h.
[hengbandforosx/hengbandosx.git] / src / dungeon.c
index 96f27ce..05b2414 100644 (file)
@@ -35,6 +35,7 @@
 #include "quest.h"
 #include "artifact.h"
 #include "avatar.h"
+#include "player-move.h"
 #include "player-status.h"
 #include "cmd-spell.h"
 #include "realm-hex.h"
@@ -1061,7 +1062,7 @@ void leave_quest_check(void)
                        q_ptr->status = QUEST_STATUS_FAILED;
                        q_ptr->complev = p_ptr->lev;
                        update_playtime();
-                       q_ptr->comptime = playtime;
+                       q_ptr->comptime = current_world_ptr->play_time;
 
                        /* Additional settings */
                        switch (q_ptr->type)
@@ -1111,7 +1112,7 @@ void leave_tower_check(void)
                        quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
                        quest[QUEST_TOWER1].complev = p_ptr->lev;
                        update_playtime();
-                       quest[QUEST_TOWER1].comptime = playtime;
+                       quest[QUEST_TOWER1].comptime = current_world_ptr->play_time;
                }
        }
 }
@@ -3087,7 +3088,7 @@ static void process_world_aux_movement(void)
                                                        q_ptr->status = QUEST_STATUS_FAILED;
                                                        q_ptr->complev = (byte)p_ptr->lev;
                                                        update_playtime();
-                                                       q_ptr->comptime = playtime;
+                                                       q_ptr->comptime = current_world_ptr->play_time;
                                                        r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
                                                }
                                        }
@@ -3450,7 +3451,7 @@ static void process_world(void)
                        p_ptr->energy_need = 0;
                        battle_monsters();
                }
-               else if (current_world_ptr->game_turn - old_turn == 150 * TURNS_PER_TICK)
+               else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
                {
                        msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
                        p_ptr->au += kakekin;
@@ -4769,10 +4770,10 @@ static void process_player(void)
        /*** Check for interupts ***/
 
        /* Complete resting */
-       if (resting < 0)
+       if (p_ptr->resting < 0)
        {
                /* Basic resting */
-               if (resting == COMMAND_ARG_REST_FULL_HEALING)
+               if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
                {
                        /* Stop resting */
                        if ((p_ptr->chp == p_ptr->mhp) &&
@@ -4783,7 +4784,7 @@ static void process_player(void)
                }
 
                /* Complete resting */
-               else if (resting == COMMAND_ARG_REST_UNTIL_DONE)
+               else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
                {
                        /* Stop resting */
                        if ((p_ptr->chp == p_ptr->mhp) &&
@@ -4968,7 +4969,7 @@ static void process_player(void)
                p_ptr->window |= PW_PLAYER;
                p_ptr->sutemi = FALSE;
                p_ptr->counter = FALSE;
-               now_damaged = FALSE;
+               p_ptr->now_damaged = FALSE;
 
                handle_stuff();
 
@@ -5008,12 +5009,12 @@ static void process_player(void)
                else if (p_ptr->action == ACTION_REST)
                {
                        /* Timed rest */
-                       if (resting > 0)
+                       if (p_ptr->resting > 0)
                        {
                                /* Reduce rest count */
-                               resting--;
+                               p_ptr->resting--;
 
-                               if (!resting) set_action(ACTION_NONE);
+                               if (!p_ptr->resting) set_action(ACTION_NONE);
                                p_ptr->redraw |= (PR_STATE);
                        }
 
@@ -5651,8 +5652,8 @@ void determine_bounty_uniques(void)
        {
                while (1)
                {
-                       kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
-                       r_ptr = &r_info[kubi_r_idx[i]];
+                       current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
+                       r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
 
                        if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
 
@@ -5660,10 +5661,10 @@ void determine_bounty_uniques(void)
 
                        if (r_ptr->rarity > 100) continue;
 
-                       if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
+                       if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
 
                        for (j = 0; j < i; j++)
-                               if (kubi_r_idx[i] == kubi_r_idx[j]) break;
+                               if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
 
                        if (j == i) break;
                }
@@ -5674,11 +5675,11 @@ void determine_bounty_uniques(void)
        {
                for (j = i; j < MAX_KUBI; j++)
                {
-                       if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
+                       if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
                        {
-                               tmp = kubi_r_idx[i];
-                               kubi_r_idx[i] = kubi_r_idx[j];
-                               kubi_r_idx[j] = tmp;
+                               tmp = current_world_ptr->bounty_r_idx[i];
+                               current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
+                               current_world_ptr->bounty_r_idx[j] = tmp;
                        }
                }
        }
@@ -5955,8 +5956,8 @@ void play_game(bool new_game)
 
        p_ptr->teleport_town = FALSE;
        p_ptr->sutemi = FALSE;
-       world_monster = FALSE;
-       now_damaged = FALSE;
+       current_world_ptr->timewalk_m_idx = 0;
+       p_ptr->now_damaged = FALSE;
        now_message = 0;
        start_time = time(NULL) - 1;
        record_o_name[0] = '\0';
@@ -6235,8 +6236,8 @@ void prevent_turn_overflow(void)
 
        if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
        else current_world_ptr->game_turn = 1; /* Paranoia */
-       if (old_turn > rollback_turns) old_turn -= rollback_turns;
-       else old_turn = 1;
+       if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
+       else current_floor_ptr->generated_turn = 1;
        if (old_battle > rollback_turns) old_battle -= rollback_turns;
        else old_battle = 1;
        if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;