From: Hourier Date: Sun, 12 Jan 2020 08:39:38 +0000 (+0900) Subject: [Refactor] #38997 IS_BLESSED() の関数マクロを普通の関数に変更し、store.is_blessed() をis_blessed_item... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5486b593c79479d6f603ac67bde447b48f346f37;p=hengband%2Fhengband.git [Refactor] #38997 IS_BLESSED() の関数マクロを普通の関数に変更し、store.is_blessed() をis_blessed_item() に変更 / Changed macro function IS_BLESSED() to normal function and is_blessed() in store.c to is_blessed_item() --- diff --git a/src/player-effects.c b/src/player-effects.c index c848b2301..501c2a371 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -1070,13 +1070,12 @@ bool set_blessed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec) { if (creature_ptr->blessed > v) return FALSE; } - else if (!IS_BLESSED()) + else if (!is_blessed(creature_ptr)) { msg_print(_("高潔な気分になった!", "You feel righteous!")); notice = TRUE; } } - else { if (creature_ptr->blessed && !music_singing(creature_ptr, MUSIC_BLESS)) diff --git a/src/player-status.c b/src/player-status.c index b8d63a741..be22fc193 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -1405,7 +1405,7 @@ void calc_bonuses(player_type *creature_ptr) bool old_mighty_throw = creature_ptr->mighty_throw; /* Current feature under player. */ - floor_type *floor_ptr = floor_ptr; + floor_type *floor_ptr = creature_ptr->current_floor_ptr; feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat]; /* Save the old armor class */ @@ -2848,7 +2848,7 @@ void calc_bonuses(player_type *creature_ptr) } /* Temporary blessing */ - if (IS_BLESSED()) + if (is_blessed(creature_ptr)) { creature_ptr->to_a += 5; creature_ptr->dis_to_a += 5; @@ -4987,7 +4987,7 @@ void update_creature(player_type *creature_ptr) { if (!creature_ptr->update) return; - floor_type *floor_ptr = floor_ptr; + floor_type *floor_ptr = creature_ptr->current_floor_ptr; if (creature_ptr->update & (PU_AUTODESTROY)) { creature_ptr->update &= ~(PU_AUTODESTROY); @@ -5174,7 +5174,7 @@ void wreck_the_pattern(player_type *creature_ptr) { int to_ruin = 0; POSITION r_y, r_x; - floor_type *floor_ptr = floor_ptr; + floor_type *floor_ptr = creature_ptr->current_floor_ptr; int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype; if (pattern_type == PATTERN_TILE_WRECKED) @@ -5920,3 +5920,13 @@ void cheat_death(player_type *creature_ptr) leave_floor(creature_ptr); wipe_m_list(); } + + +/*! + * @param creature_ptr プレーヤーへの参照ポインタ + * @return 祝福状態ならばTRUE + */ +bool is_blessed(player_type *creature_ptr) +{ + return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(HEX_BLESS); +} diff --git a/src/player-status.h b/src/player-status.h index 8ada2933c..7d1aba959 100644 --- a/src/player-status.h +++ b/src/player-status.h @@ -32,6 +32,8 @@ #define MAGIC_GAIN_EXP 0x0004 /* + * todo ここからp_ptrを消すと、object-hookにある大量の関数ポインタを全部修正する必要がある + * 影響範囲が広すぎるので保留 * Magic-books for the realms */ #define REALM1_BOOK (p_ptr->realm1 + TV_LIFE_BOOK - 1) @@ -800,7 +802,6 @@ extern const s32b player_exp_a[PY_MAX_LEVEL]; #define IS_FAST(C) (C->fast || music_singing(C, MUSIC_SPEED) || music_singing(C, MUSIC_SHERO)) #define IS_INVULN(C) (C->invuln || music_singing(C, MUSIC_INVULN)) #define IS_HERO(C) (C->hero || music_singing(C, MUSIC_HERO) || music_singing(C, MUSIC_SHERO)) -#define IS_BLESSED() (p_ptr->blessed || music_singing(p_ptr, MUSIC_BLESS) || hex_spelling(HEX_BLESS)) #define IS_OPPOSE_ACID() (p_ptr->oppose_acid || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) #define IS_OPPOSE_ELEC() (p_ptr->oppose_elec || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) #define IS_OPPOSE_FIRE() (p_ptr->oppose_fire || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) @@ -811,6 +812,8 @@ extern const s32b player_exp_a[PY_MAX_LEVEL]; #define P_PTR_KI (p_ptr->magic_num1[0]) +extern bool is_blessed(player_type *player_ptr); + /* * Player "food" crucial values */ diff --git a/src/selfinfo.c b/src/selfinfo.c index 275db489f..fe3c0e207 100644 --- a/src/selfinfo.c +++ b/src/selfinfo.c @@ -1020,7 +1020,7 @@ void self_knowledge(player_type *creature_ptr) { info[i++] = _("あなたは魔力を吸われている。", "You brain is drained."); } - if (IS_BLESSED()) + if (is_blessed(creature_ptr)) { info[i++] = _("あなたは高潔さを感じている。", "You feel rightous."); } diff --git a/src/store.c b/src/store.c index 43672a9d0..6bc64bac2 100644 --- a/src/store.c +++ b/src/store.c @@ -2626,7 +2626,7 @@ static int store_check_num(object_type *o_ptr) * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ * @return アイテムが祝福されたアイテムならばTRUEを返す */ -static bool is_blessed(object_type *o_ptr) +static bool is_blessed_item(object_type *o_ptr) { BIT_FLAGS flgs[TR_FLAG_SIZE]; object_flags(o_ptr, flgs); @@ -2766,7 +2766,7 @@ static bool store_will_buy(object_type *o_ptr) case TV_POLEARM: case TV_SWORD: { - if (is_blessed(o_ptr)) break; + if (is_blessed_item(o_ptr)) break; } default: return FALSE; diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 5e9504d6c..8a77b1a70 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -573,7 +573,7 @@ static void prt_status(player_type *creature_ptr) if (creature_ptr->shero) ADD_FLG(BAR_BERSERK); /* Blessed */ - if (IS_BLESSED()) ADD_FLG(BAR_BLESSED); + if (is_blessed(creature_ptr)) ADD_FLG(BAR_BLESSED); /* Shield */ if (creature_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);