OSDN Git Service

[Refactor] #38997 set_tim_stealth() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Sun, 23 Jun 2019 05:36:14 +0000 (14:36 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 23 Jun 2019 05:36:14 +0000 (14:36 +0900)
src/core.c
src/player-effects.c
src/player-effects.h

index c78d71c..18ce55a 100644 (file)
@@ -1869,7 +1869,7 @@ static void process_world_aux_timeout(void)
        /* Timed stealth */
        if (p_ptr->tim_stealth)
        {
-               (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
+               (void)set_tim_stealth(p_ptr, p_ptr->tim_stealth - 1, TRUE);
        }
 
        /* Timed levitation */
index be93a75..e8f7d29 100644 (file)
@@ -313,7 +313,7 @@ void dispel_player(void)
        (void)set_tim_infra(p_ptr, 0, TRUE);
        (void)set_tim_esp(0, TRUE);
        (void)set_tim_regen(p_ptr, 0, TRUE);
-       (void)set_tim_stealth(0, TRUE);
+       (void)set_tim_stealth(p_ptr, 0, TRUE);
        (void)set_tim_levitation(0, TRUE);
        (void)set_tim_sh_touki(0, TRUE);
        (void)set_tim_sh_fire(0, TRUE);
@@ -1633,19 +1633,19 @@ bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
  * @param do_dec 現在の継続時間より長い値のみ上書きする
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
+bool set_tim_stealth(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 {
        bool notice = FALSE;
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
-       if (p_ptr->is_dead) return FALSE;
+       if (creature_ptr->is_dead) return FALSE;
 
        /* Open */
        if (v)
        {
-               if (p_ptr->tim_stealth && !do_dec)
+               if (creature_ptr->tim_stealth && !do_dec)
                {
-                       if (p_ptr->tim_stealth > v) return FALSE;
+                       if (creature_ptr->tim_stealth > v) return FALSE;
                }
                else if (!IS_TIM_STEALTH())
                {
@@ -1657,7 +1657,7 @@ bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
        /* Shut */
        else
        {
-               if (p_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
+               if (creature_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
                {
                        msg_print(_("足音が大きくなった。", "You no longer walk silently."));
                        notice = TRUE;
@@ -1665,14 +1665,14 @@ bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
        }
 
        /* Use the value */
-       p_ptr->tim_stealth = v;
-       p_ptr->redraw |= (PR_STATUS);
+       creature_ptr->tim_stealth = v;
+       creature_ptr->redraw |= (PR_STATUS);
 
        /* Nothing to notice */
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-       p_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_BONUS);
        handle_stuff();
        return (TRUE);
 }
index 80a49e6..ac4e9cf 100644 (file)
@@ -34,7 +34,7 @@ extern bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_tim_infra(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-extern bool set_tim_stealth(TIME_EFFECT v, bool do_dec);
+extern bool set_tim_stealth(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_lightspeed(TIME_EFFECT v, bool do_dec);
 extern bool set_tim_levitation(TIME_EFFECT v, bool do_dec);
 extern bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec);