OSDN Git Service

[Refactor] #38844 player_type 構造体に resting を取り込む。 / Move resting to player_type...
authordeskull <deskull@users.sourceforge.jp>
Sun, 3 Mar 2019 11:27:02 +0000 (20:27 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 3 Mar 2019 11:27:02 +0000 (20:27 +0900)
src/cmd2.c
src/dungeon.c
src/effects.c
src/externs.h
src/types.h
src/variable.c
src/view-mainwindow.c

index d64b54c..858c9b9 100644 (file)
@@ -2213,7 +2213,7 @@ void do_cmd_rest(void)
                        chg_virtue(V_DILIGENCE, -1);
 
        /* Save the rest code */
-       resting = command_arg;
+       p_ptr->resting = command_arg;
        p_ptr->action = ACTION_REST;
        p_ptr->update |= (PU_BONUS);
        update_creature(p_ptr);
index 6c24001..a5b1fe7 100644 (file)
@@ -4769,10 +4769,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 +4783,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) &&
@@ -5008,12 +5008,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);
                        }
 
index 2e1f229..a212a06 100644 (file)
@@ -49,7 +49,7 @@ void set_action(ACTION_IDX typ)
                        }
                        case ACTION_REST:
                        {
-                               resting = 0;
+                               p_ptr->resting = 0;
                                break;
                        }
                        case ACTION_LEARN:
index c640734..c03dbd1 100644 (file)
@@ -158,7 +158,6 @@ extern s16b command_wrk;
 extern s16b command_new;
 extern bool msg_flag;
 extern s16b running;
-extern GAME_TURN resting;
 extern bool invoking_midnight_curse;
 extern GAME_TURN old_battle;
 extern bool use_sound;
index c813f94..bbe3637 100644 (file)
@@ -1107,7 +1107,7 @@ struct player_type
        TIME_EFFECT dustrobe;          /* Timed -- Robe of dust */
 
        bool timewalk;
-
+       GAME_TURN resting;      /* Current counter for resting, if any */
 
        PATRON_IDX chaos_patron;
 
index 3468a2e..dc54611 100644 (file)
@@ -109,7 +109,6 @@ s16b command_new;           /* Command chaining from inven/equip view */
 bool msg_flag;                 /* Used in msg_print() for "buffering" */
 
 s16b running;                  /* Current counter for running, if any */
-GAME_TURN resting;                     /* Current counter for resting, if any */
 
 bool invoking_midnight_curse; /*!< 悪夢モード時の真夜中太古の呪い発生処理フラグ */
 
index b5b1cb7..bc093fc 100644 (file)
@@ -1057,9 +1057,9 @@ static void prt_state(void)
                                strcpy(text, _("    ", "    "));
 
                                /* Extensive (timed) rest */
-                               if (resting >= 1000)
+                               if (p_ptr->resting >= 1000)
                                {
-                                       i = resting / 100;
+                                       i = p_ptr->resting / 100;
                                        text[3] = '0';
                                        text[2] = '0';
                                        text[1] = '0' + (i % 10);
@@ -1067,9 +1067,9 @@ static void prt_state(void)
                                }
 
                                /* Long (timed) rest */
-                               else if (resting >= 100)
+                               else if (p_ptr->resting >= 100)
                                {
-                                       i = resting;
+                                       i = p_ptr->resting;
                                        text[3] = '0' + (i % 10);
                                        i = i / 10;
                                        text[2] = '0' + (i % 10);
@@ -1077,28 +1077,28 @@ static void prt_state(void)
                                }
 
                                /* Medium (timed) rest */
-                               else if (resting >= 10)
+                               else if (p_ptr->resting >= 10)
                                {
-                                       i = resting;
+                                       i = p_ptr->resting;
                                        text[3] = '0' + (i % 10);
                                        text[2] = '0' + (i / 10);
                                }
 
                                /* Short (timed) rest */
-                               else if (resting > 0)
+                               else if (p_ptr->resting > 0)
                                {
-                                       i = resting;
+                                       i = p_ptr->resting;
                                        text[3] = '0' + (i);
                                }
 
                                /* Rest until healed */
-                               else if (resting == COMMAND_ARG_REST_FULL_HEALING)
+                               else if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
                                {
                                        text[0] = text[1] = text[2] = text[3] = '*';
                                }
 
                                /* Rest until done */
-                               else if (resting == COMMAND_ARG_REST_UNTIL_DONE)
+                               else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
                                {
                                        text[0] = text[1] = text[2] = text[3] = '&';
                                }