OSDN Git Service

[Refactor] #38852 p_ptr->notice を p_ptr->update へ統合。 / Integrate p_ptr->notice to...
[hengband/hengband.git] / src / effects.c
index 8cb29aa..4fcec76 100644 (file)
@@ -116,11 +116,7 @@ void set_action(ACTION_IDX typ)
                        break;
                }
        }
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Redraw the state */
        p_ptr->redraw |= (PR_STATE);
 }
 
@@ -173,7 +169,6 @@ void reset_tim_flags(void)
        p_ptr->dustrobe = 0;
        p_ptr->action = ACTION_NONE;
 
-
        p_ptr->oppose_acid = 0;     /* Timed -- oppose acid */
        p_ptr->oppose_elec = 0;     /* Timed -- oppose lightning */
        p_ptr->oppose_fire = 0;     /* Timed -- oppose heat */
@@ -270,18 +265,11 @@ void dispel_player(void)
                INTERUPTING_SONG_EFFECT(p_ptr) = SINGING_SONG_EFFECT(p_ptr);
                SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                msg_format(_("%sが途切れた。", "Your %s is interrupted."), str);
-               p_ptr->action = ACTION_NONE;
-
-               /* Recalculate bonuses */
-               p_ptr->update |= (PU_BONUS | PU_HP);
 
+               p_ptr->action = ACTION_NONE;
+               p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
                p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
-
-               /* Update monsters */
-               p_ptr->update |= (PU_MONSTERS);
-
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
                p_ptr->energy_need += ENERGY_NEED();
        }
 }
@@ -342,8 +330,6 @@ bool set_mimic(TIME_EFFECT v, IDX p, bool do_dec)
 
        /* Redraw title */
        p_ptr->redraw |= (PR_BASIC | PR_STATUS);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS | PU_HP);
 
        handle_stuff();
@@ -423,8 +409,6 @@ bool set_blind(TIME_EFFECT v)
        p_ptr->redraw |= (PR_MAP);
 
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -511,8 +495,6 @@ bool set_confused(TIME_EFFECT v)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -562,8 +544,6 @@ bool set_poisoned(TIME_EFFECT v)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -627,8 +607,6 @@ bool set_afraid(TIME_EFFECT v)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -684,11 +662,7 @@ bool set_paralyzed(TIME_EFFECT v)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Redraw the state */
        p_ptr->redraw |= (PR_STATE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -750,13 +724,9 @@ bool set_image(TIME_EFFECT v)
 
        /* Update the health bar */
        p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
-
-       /* Update monsters */
        p_ptr->update |= (PU_MONSTERS);
 
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -809,11 +779,7 @@ bool set_fast(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -868,11 +834,7 @@ bool set_lightspeed(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -923,11 +885,7 @@ bool set_slow(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -982,11 +940,7 @@ bool set_shield(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1041,11 +995,7 @@ bool set_tsubureru(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1100,11 +1050,7 @@ bool set_magicdef(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1158,11 +1104,7 @@ bool set_blessed(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1217,14 +1159,10 @@ bool set_hero(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Recalculate hitpoints */
        p_ptr->update |= (PU_HP);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1279,14 +1217,10 @@ bool set_shero(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Recalculate hitpoints */
        p_ptr->update |= (PU_HP);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1340,8 +1274,6 @@ bool set_protevil(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1378,8 +1310,6 @@ bool set_wraith_form(TIME_EFFECT v, bool do_dec)
                        chg_virtue(V_VALOUR, -5);
 
                        p_ptr->redraw |= (PR_MAP);
-
-                       /* Update monsters */
                        p_ptr->update |= (PU_MONSTERS);
 
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
@@ -1395,8 +1325,6 @@ bool set_wraith_form(TIME_EFFECT v, bool do_dec)
                        notice = TRUE;
 
                        p_ptr->redraw |= (PR_MAP);
-
-                       /* Update monsters */
                        p_ptr->update |= (PU_MONSTERS);
 
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
@@ -1413,11 +1341,7 @@ bool set_wraith_form(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 
@@ -1456,8 +1380,6 @@ bool set_invuln(TIME_EFFECT v, bool do_dec)
                        chg_virtue(V_VALOUR, -5);
 
                        p_ptr->redraw |= (PR_MAP);
-
-                       /* Update monsters */
                        p_ptr->update |= (PU_MONSTERS);
 
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
@@ -1473,8 +1395,6 @@ bool set_invuln(TIME_EFFECT v, bool do_dec)
                        notice = TRUE;
 
                        p_ptr->redraw |= (PR_MAP);
-
-                       /* Update monsters */
                        p_ptr->update |= (PU_MONSTERS);
 
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
@@ -1493,11 +1413,7 @@ bool set_invuln(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1551,14 +1467,8 @@ bool set_tim_esp(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Update the monsters */
        p_ptr->update |= (PU_MONSTERS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1612,14 +1522,10 @@ bool set_tim_invis(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Update the monsters */
        p_ptr->update |= (PU_MONSTERS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1673,14 +1579,10 @@ bool set_tim_infra(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Update the monsters */
        p_ptr->update |= (PU_MONSTERS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1734,11 +1636,7 @@ bool set_tim_regen(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1792,11 +1690,7 @@ bool set_tim_stealth(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1907,11 +1801,7 @@ bool set_tim_levitation(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -1965,8 +1855,6 @@ bool set_tim_sh_touki(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2020,11 +1908,7 @@ bool set_tim_sh_fire(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2078,11 +1962,7 @@ bool set_tim_sh_holy(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2136,11 +2016,7 @@ bool set_tim_eyeeye(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2195,11 +2071,7 @@ bool set_resist_magic(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2253,11 +2125,7 @@ bool set_tim_reflect(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2309,11 +2177,7 @@ bool set_multishadow(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2367,11 +2231,7 @@ bool set_dustrobe(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2425,11 +2285,7 @@ bool set_kabenuke(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2489,14 +2345,10 @@ bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Recalculate hitpoints */
        p_ptr->update |= (PU_HP);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2573,8 +2425,6 @@ bool set_ele_attack(u32b attack_type, TIME_EFFECT v)
        p_ptr->redraw |= (PR_STATUS);
 
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
 
        return (TRUE);
@@ -2652,8 +2502,6 @@ bool set_ele_immune(u32b immune_type, TIME_EFFECT v)
        p_ptr->redraw |= (PR_STATUS);
 
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
 
        return (TRUE);
@@ -2708,8 +2556,6 @@ bool set_oppose_acid(TIME_EFFECT v, bool do_dec)
        p_ptr->redraw |= (PR_STATUS);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2763,8 +2609,6 @@ bool set_oppose_elec(TIME_EFFECT v, bool do_dec)
        p_ptr->redraw |= (PR_STATUS);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2819,8 +2663,6 @@ bool set_oppose_fire(TIME_EFFECT v, bool do_dec)
        p_ptr->redraw |= (PR_STATUS);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2874,8 +2716,6 @@ bool set_oppose_cold(TIME_EFFECT v, bool do_dec)
        p_ptr->redraw |= (PR_STATUS);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -2930,8 +2770,6 @@ bool set_oppose_pois(TIME_EFFECT v, bool do_dec)
        p_ptr->redraw |= (PR_STATUS);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -3082,14 +2920,10 @@ bool set_stun(TIME_EFFECT v)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Redraw the "stun" */
        p_ptr->redraw |= (PR_STUN);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -3279,14 +3113,10 @@ bool set_cut(TIME_EFFECT v)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Redraw the "cut" */
        p_ptr->redraw |= (PR_CUT);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -3477,14 +3307,10 @@ bool set_food(TIME_EFFECT v)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Redraw hunger */
        p_ptr->redraw |= (PR_HUNGER);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -3544,8 +3370,6 @@ bool inc_stat(int stat)
                {
                        p_ptr->stat_max[stat] = value;
                }
-
-               /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
 
                /* Success */
@@ -3679,8 +3503,6 @@ bool dec_stat(int stat, int amount, int permanent)
 
                /* Redisplay the stats later */
                p_ptr->redraw |= (PR_STATS);
-
-               /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
        }
 
@@ -3700,8 +3522,6 @@ bool res_stat(int stat)
        {
                /* Restore */
                p_ptr->stat_cur[stat] = p_ptr->stat_max[stat];
-
-               /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
 
                /* Redisplay the stats later */
@@ -3745,7 +3565,6 @@ bool hp_player(int num)
                        p_ptr->chp_frac = 0;
                }
 
-               /* Redraw */
                p_ptr->redraw |= (PR_HP);
 
                p_ptr->window |= (PW_PLAYER);
@@ -3971,12 +3790,10 @@ bool lose_all_info(void)
                /* Hack -- Clear the "felt" flag */
                o_ptr->ident &= ~(IDENT_SENSE);
        }
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
 
        /* Combine / Reorder the pack (later) */
-       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
+       p_ptr->update |= (PU_COMBINE | PU_REORDER);
 
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
@@ -4787,11 +4604,7 @@ bool set_ultimate_res(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -4839,11 +4652,7 @@ bool set_tim_res_nether(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -4891,11 +4700,7 @@ bool set_tim_res_time(TIME_EFFECT v, bool do_dec)
        if (!notice) return (FALSE);
 
        if (disturb_state) disturb(FALSE, FALSE);
-
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
        return (TRUE);
 }
@@ -4915,8 +4720,6 @@ bool choose_ele_attack(void)
                msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
                return FALSE;
        }
-
-       /* Save screen */
        screen_save();
 
        num = (p_ptr->lev - 20) / 5;
@@ -4967,7 +4770,6 @@ bool choose_ele_attack(void)
                screen_load();
                return FALSE;
        }
-       /* Load screen */
        screen_load();
        return TRUE;
 }
@@ -4979,8 +4781,6 @@ bool choose_ele_attack(void)
 bool choose_ele_immune(TIME_EFFECT immune_turn)
 {
        char choice;
-
-       /* Save screen */
        screen_save();
 
        c_prt(TERM_RED,    _("        a) 火炎", "        a) Immune Fire"), 2, 14);
@@ -5012,7 +4812,6 @@ bool choose_ele_immune(TIME_EFFECT immune_turn)
                screen_load();
                return FALSE;
        }
-       /* Load screen */
        screen_load();
        return TRUE;
 }