OSDN Git Service

[Refactor] #38997 set_confused() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Fri, 21 Jun 2019 14:39:48 +0000 (23:39 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 21 Jun 2019 14:39:48 +0000 (23:39 +0900)
15 files changed:
src/bldg.c
src/cmd-eat.c
src/core.c
src/melee1.c
src/mind.c
src/mspells4.c
src/player-effects.c
src/player-effects.h
src/player-status.c
src/spells-object.c
src/spells-status.c
src/spells1.c
src/spells2.c
src/spells3.c
src/trap.c

index e9a89a2..9e7b2af 100644 (file)
@@ -2066,7 +2066,7 @@ static bool inn_comm(int cmd)
                                else
                                {
                                        set_blind(p_ptr, 0);
-                                       set_confused(0);
+                                       set_confused(p_ptr, 0);
                                        p_ptr->stun = 0;
                                        p_ptr->chp = p_ptr->mhp;
                                        p_ptr->csp = p_ptr->msp;
index 1192dc7..e3d354a 100644 (file)
@@ -106,7 +106,7 @@ void exe_eat_food(INVENTORY_IDX item)
                {
                        if (!p_ptr->resist_conf)
                        {
-                               if (set_confused(p_ptr->confused + randint0(10) + 10))
+                               if (set_confused(p_ptr, p_ptr->confused + randint0(10) + 10))
                                {
                                        ident = TRUE;
                                }
@@ -206,7 +206,7 @@ void exe_eat_food(INVENTORY_IDX item)
 
                case SV_FOOD_CURE_CONFUSION:
                {
-                       if (set_confused(0)) ident = TRUE;
+                       if (set_confused(p_ptr, 0)) ident = TRUE;
                        break;
                }
 
index bb56078..c83a105 100644 (file)
@@ -1959,7 +1959,7 @@ static void process_world_aux_timeout(void)
        /* Confusion */
        if (p_ptr->confused)
        {
-               (void)set_confused(p_ptr->confused - dec_count);
+               (void)set_confused(p_ptr, p_ptr->confused - dec_count);
        }
 
        /* Afraid */
@@ -2196,7 +2196,7 @@ static void process_world_aux_mutation(void)
 
                if (!p_ptr->resist_conf)
                {
-                       (void)set_confused(p_ptr->confused + randint0(20) + 15);
+                       (void)set_confused(p_ptr, p_ptr->confused + randint0(20) + 15);
                }
 
                if (!p_ptr->resist_chaos)
index 1f34aa6..ff2df20 100644 (file)
@@ -3206,7 +3206,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                        /* Increase "confused" */
                                        if (!p_ptr->resist_conf && !CHECK_MULTISHADOW())
                                        {
-                                               if (set_confused(p_ptr->confused + 3 + randint1(rlev)))
+                                               if (set_confused(p_ptr, p_ptr->confused + 3 + randint1(rlev)))
                                                {
                                                        obvious = TRUE;
                                                }
index 02070b7..c1371f0 100644 (file)
@@ -1915,7 +1915,7 @@ void do_cmd_mind(void)
                                else if (b < 45)
                                {
                                        msg_print(_("あなたの頭は混乱した!", "Your brain is addled!"));
-                                       set_confused(p_ptr->confused + randint1(8));
+                                       set_confused(p_ptr, p_ptr->confused + randint1(8));
                                }
                                else if (b < 90)
                                {
index e3d9696..70d7f56 100644 (file)
@@ -1568,7 +1568,7 @@ void spell_RF5_CONF(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 
                if (!resist && !saving_throw)
                {
-                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
+                       (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4);
                }
                learn_spell(MS_CONF);
                update_smart_learn(m_idx, DRS_CONF);
index 06850e1..8d43f45 100644 (file)
@@ -487,55 +487,55 @@ bool set_blind(player_type *creature_ptr, TIME_EFFECT v)
  * @param v 継続時間
  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
  */
-bool set_confused(TIME_EFFECT v)
+bool set_confused(player_type *creature_ptr, TIME_EFFECT v)
 {
        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->confused)
+               if (!creature_ptr->confused)
                {
                        msg_print(_("あなたは混乱した!", "You are confused!"));
 
-                       if (p_ptr->action == ACTION_LEARN)
+                       if (creature_ptr->action == ACTION_LEARN)
                        {
                                msg_print(_("学習が続けられない!", "You cannot continue Learning!"));
-                               p_ptr->new_mane = FALSE;
+                               creature_ptr->new_mane = FALSE;
 
-                               p_ptr->redraw |= (PR_STATE);
-                               p_ptr->action = ACTION_NONE;
+                               creature_ptr->redraw |= (PR_STATE);
+                               creature_ptr->action = ACTION_NONE;
                        }
-                       if (p_ptr->action == ACTION_KAMAE)
+                       if (creature_ptr->action == ACTION_KAMAE)
                        {
                                msg_print(_("構えがとけた。", "Your posture gets loose."));
-                               p_ptr->special_defense &= ~(KAMAE_MASK);
-                               p_ptr->update |= (PU_BONUS);
-                               p_ptr->redraw |= (PR_STATE);
-                               p_ptr->action = ACTION_NONE;
+                               creature_ptr->special_defense &= ~(KAMAE_MASK);
+                               creature_ptr->update |= (PU_BONUS);
+                               creature_ptr->redraw |= (PR_STATE);
+                               creature_ptr->action = ACTION_NONE;
                        }
-                       else if (p_ptr->action == ACTION_KATA)
+                       else if (creature_ptr->action == ACTION_KATA)
                        {
                                msg_print(_("型が崩れた。", "Your posture gets loose."));
-                               p_ptr->special_defense &= ~(KATA_MASK);
-                               p_ptr->update |= (PU_BONUS);
-                               p_ptr->update |= (PU_MONSTERS);
-                               p_ptr->redraw |= (PR_STATE);
-                               p_ptr->redraw |= (PR_STATUS);
-                               p_ptr->action = ACTION_NONE;
+                               creature_ptr->special_defense &= ~(KATA_MASK);
+                               creature_ptr->update |= (PU_BONUS);
+                               creature_ptr->update |= (PU_MONSTERS);
+                               creature_ptr->redraw |= (PR_STATE);
+                               creature_ptr->redraw |= (PR_STATUS);
+                               creature_ptr->action = ACTION_NONE;
                        }
 
                        /* Sniper */
-                       if (p_ptr->concent) reset_concentration(TRUE);
+                       if (creature_ptr->concent) reset_concentration(TRUE);
 
                        /* Hex */
                        if (hex_spelling_any()) stop_hex_spell_all();
 
                        notice = TRUE;
-                       p_ptr->counter = FALSE;
+                       creature_ptr->counter = FALSE;
                        chg_virtue(V_HARMONY, -1);
                }
        }
@@ -543,17 +543,17 @@ bool set_confused(TIME_EFFECT v)
        /* Shut */
        else
        {
-               if (p_ptr->confused)
+               if (creature_ptr->confused)
                {
                        msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
-                       p_ptr->special_attack &= ~(ATTACK_SUIKEN);
+                       creature_ptr->special_attack &= ~(ATTACK_SUIKEN);
                        notice = TRUE;
                }
        }
 
        /* Use the value */
-       p_ptr->confused = v;
-       p_ptr->redraw |= (PR_STATUS);
+       creature_ptr->confused = v;
+       creature_ptr->redraw |= (PR_STATUS);
 
        /* Nothing to notice */
        if (!notice) return (FALSE);
index abcb72b..23d0741 100644 (file)
@@ -16,7 +16,7 @@ extern void reset_tim_flags(void);
 extern void dispel_player(void);
 extern bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, IDX p, bool do_dec);
 extern bool set_blind(player_type *creature_ptr, TIME_EFFECT v);
-extern bool set_confused(TIME_EFFECT v);
+extern bool set_confused(player_type *creature_ptr, TIME_EFFECT v);
 extern bool set_poisoned(TIME_EFFECT v);
 extern bool set_afraid(TIME_EFFECT v);
 extern bool set_paralyzed(TIME_EFFECT v);
index e5c37fb..c764d2a 100644 (file)
@@ -5447,7 +5447,7 @@ void sanity_blast(monster_type *m_ptr, bool necro)
                /* Brain smash */
                if (!p_ptr->resist_conf)
                {
-                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
+                       (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4);
                }
                if (!p_ptr->free_act)
                {
index 2cc9575..38d8ebd 100644 (file)
@@ -846,13 +846,13 @@ bool perilous_secrets(player_type *creature_ptr)
                        (void)set_paralyzed(creature_ptr->paralyzed + randint1(5 * oops + 1));
 
                        /* Confusing. */
-                       (void)set_confused(creature_ptr->confused + randint1(5 * oops + 1));
+                       (void)set_confused(p_ptr, creature_ptr->confused + randint1(5 * oops + 1));
                }
                creature_ptr->redraw |= (PR_MANA);
        }
        take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
        /* Confusing. */
-       if (one_in_(5)) (void)set_confused(creature_ptr->confused + randint1(10));
+       if (one_in_(5)) (void)set_confused(p_ptr, creature_ptr->confused + randint1(10));
 
        /* Exercise a little care... */
        if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
index 76623df..1b0335a 100644 (file)
@@ -279,7 +279,7 @@ bool_hack life_stream(bool_hack message, bool_hack virtue_change)
        restore_level();
        (void)set_poisoned(0);
        (void)set_blind(p_ptr, 0);
-       (void)set_confused(0);
+       (void)set_confused(p_ptr, 0);
        (void)set_image(0);
        (void)set_stun(0);
        (void)set_cut(0);
@@ -324,7 +324,7 @@ bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
        bool_hack ident = FALSE;
        if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE;
        if (set_blind(p_ptr, 0)) ident = TRUE;
-       if (set_confused(0)) ident = TRUE;
+       if (set_confused(p_ptr, 0)) ident = TRUE;
        if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
        if (set_shero(0, TRUE)) ident = TRUE;
        return ident;
@@ -335,7 +335,7 @@ bool_hack cure_critical_wounds(HIT_POINT pow)
        bool_hack ident = FALSE;
        if (hp_player(p_ptr, pow)) ident = TRUE;
        if (set_blind(p_ptr, 0)) ident = TRUE;
-       if (set_confused(0)) ident = TRUE;
+       if (set_confused(p_ptr, 0)) ident = TRUE;
        if (set_poisoned(0)) ident = TRUE;
        if (set_stun(0)) ident = TRUE;
        if (set_cut(0)) ident = TRUE;
@@ -348,7 +348,7 @@ bool_hack true_healing(HIT_POINT pow)
        bool_hack ident = FALSE;
        if (hp_player(p_ptr, pow)) ident = TRUE;
        if (set_blind(p_ptr, 0)) ident = TRUE;
-       if (set_confused(0)) ident = TRUE;
+       if (set_confused(p_ptr, 0)) ident = TRUE;
        if (set_poisoned(0)) ident = TRUE;
        if (set_stun(0)) ident = TRUE;
        if (set_cut(0)) ident = TRUE;
index 2df6a67..5385811 100644 (file)
@@ -1744,7 +1744,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
                                                                switch (randint1(4))
                                                                {
                                                                        case 1:
-                                                                               set_confused(p_ptr->confused + 3 + randint1(dam));
+                                                                               set_confused(p_ptr, p_ptr->confused + 3 + randint1(dam));
                                                                                break;
                                                                        case 2:
                                                                                set_stun(p_ptr->stun + randint1(dam));
@@ -1942,7 +1942,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
                                                                        set_stun(p_ptr->stun + dam / 2);
                                                                        break;
                                                                case 2:
-                                                                       set_confused(p_ptr->confused + dam / 2);
+                                                                       set_confused(p_ptr, p_ptr->confused + dam / 2);
                                                                        break;
                                                                default:
                                                                {
@@ -4306,7 +4306,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                                }
                                if (!p_ptr->resist_conf && !p_ptr->resist_water)
                                {
-                                       set_confused(p_ptr->confused + randint1(5) + 5);
+                                       set_confused(p_ptr, p_ptr->confused + randint1(5) + 5);
                                }
 
                                if (one_in_(5) && !p_ptr->resist_water)
@@ -4334,7 +4334,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                        {
                                if (!p_ptr->resist_conf)
                                {
-                                       (void)set_confused(p_ptr->confused + randint0(20) + 10);
+                                       (void)set_confused(p_ptr, p_ptr->confused + randint0(20) + 10);
                                }
                                if (!p_ptr->resist_chaos)
                                {
@@ -4416,7 +4416,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                        }
                        else if (!CHECK_MULTISHADOW())
                        {
-                               (void)set_confused(p_ptr->confused + randint1(20) + 10);
+                               (void)set_confused(p_ptr, p_ptr->confused + randint1(20) + 10);
                        }
                        get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
                        break;
@@ -4876,7 +4876,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
 
                                        if (!p_ptr->resist_conf)
                                        {
-                                               (void)set_confused(p_ptr->confused + randint0(4) + 4);
+                                               (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4);
                                        }
 
                                        if (!p_ptr->resist_chaos && one_in_(3))
@@ -4930,7 +4930,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
                                        }
                                        if (!p_ptr->resist_conf)
                                        {
-                                               (void)set_confused(p_ptr->confused + randint0(4) + 4);
+                                               (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4);
                                        }
                                        if (!p_ptr->free_act)
                                        {
index 24d10e3..7dad380 100644 (file)
@@ -3563,7 +3563,7 @@ void cast_invoke_spirits(DIRECTION dir)
                msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
                        "Your head is invaded by a horde of gibbering spectral voices..."));
 
-               set_confused(p_ptr->confused + randint1(4) + 4);
+               set_confused(p_ptr, p_ptr->confused + randint1(4) + 4);
        }
        else if (die < 31)
        {
index 66936a1..359f52b 100644 (file)
@@ -3434,7 +3434,7 @@ bool booze(player_type *creature_ptr)
        else if (!creature_ptr->resist_conf) creature_ptr->special_attack |= ATTACK_SUIKEN;
        if (!creature_ptr->resist_conf)
        {
-               if (set_confused(randint0(20) + 15))
+               if (set_confused(p_ptr, randint0(20) + 15))
                {
                        ident = TRUE;
                }
index 6ad01a4..479d3ac 100644 (file)
@@ -538,7 +538,7 @@ void hit_trap(bool break_trap)
 
        case TRAP_CONFUSE:
        {
-               hit_trap_set_abnormal_status(
+               hit_trap_set_abnormal_status_p(
                        _("きらめくガスに包み込まれた!", "A gas of scintillating colors surrounds you!"),
                        p_ptr->resist_conf,
                        set_confused, p_ptr->confused + (TIME_EFFECT)randint0(20) + 10);