From: deskull Date: Tue, 5 Nov 2019 15:42:11 +0000 (+0900) Subject: [Refactor] #38997 apply_disenchant() に player_type * 引数を追加. / Add player_type * argum... X-Git-Tag: vmacos3.0.0-alpha52~2532 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bcfaf9a2fbada6ad5ae75a486b6b1ab8f34a2eb1;p=hengbandforosx%2Fhengbandosx.git [Refactor] #38997 apply_disenchant() に player_type * 引数を追加. / Add player_type * argument to apply_disenchant(). --- diff --git a/src/chest.c b/src/chest.c index 0915a5c17..a2eb47def 100644 --- a/src/chest.c +++ b/src/chest.c @@ -293,7 +293,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) (void)set_stun(p_ptr, p_ptr->stun + 10 + randint0(100)); } - else if (one_in_(3)) apply_disenchant(0); + else if (one_in_(3)) apply_disenchant(p_ptr, 0); else if (one_in_(2)) { (void)do_dec_stat(p_ptr, A_STR); diff --git a/src/combat/melee1.c b/src/combat/melee1.c index bb328e9f6..68af2ad8b 100644 --- a/src/combat/melee1.c +++ b/src/combat/melee1.c @@ -2840,7 +2840,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) if (!target_ptr->resist_disen && !CHECK_MULTISHADOW(target_ptr)) { /* Apply disenchantment */ - if (apply_disenchant(0)) + if (apply_disenchant(target_ptr, 0)) { /* Hack -- Update AC */ update_creature(target_ptr); diff --git a/src/spells.h b/src/spells.h index 8e5fe1ef0..1ebaf7641 100644 --- a/src/spells.h +++ b/src/spells.h @@ -294,7 +294,7 @@ extern void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx); extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns); extern bool free_level_recall(player_type *creature_ptr); extern bool reset_recall(void); -extern bool apply_disenchant(BIT_FLAGS mode); +extern bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode); extern void call_the_(void); extern void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los); extern void alter_reality(void); diff --git a/src/spells1.c b/src/spells1.c index 367a015f5..4a1aec382 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -4430,7 +4430,7 @@ static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name } else if (!CHECK_MULTISHADOW(target_ptr)) { - (void)apply_disenchant(0); + (void)apply_disenchant(target_ptr, 0); } get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell); break; diff --git a/src/spells2.c b/src/spells2.c index d0c1e4fdb..3b909e127 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -3254,7 +3254,7 @@ void wild_magic(int spell) break; case 29: case 30: - apply_disenchant(1); + apply_disenchant(p_ptr, 1); break; case 31: lose_all_info(p_ptr); diff --git a/src/spells3.c b/src/spells3.c index bfa7f6588..3db5aaa61 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -930,9 +930,9 @@ bool reset_recall(void) * @return 劣化処理に関するメッセージが発せられた場合はTRUEを返す / * Return "TRUE" if the player notices anything */ -bool apply_disenchant(BIT_FLAGS mode) +bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode) { - int t = 0; + int t = 0; object_type *o_ptr; GAME_TEXT o_name[MAX_NLEN]; int to_h, to_d, to_a, pval; @@ -950,7 +950,7 @@ bool apply_disenchant(BIT_FLAGS mode) case 8: t = INVEN_FEET; break; } - o_ptr = &p_ptr->inventory_list[t]; + o_ptr = &target_ptr->inventory_list[t]; /* No item, nothing happens */ if (!o_ptr->k_idx) return (FALSE); @@ -1013,12 +1013,12 @@ bool apply_disenchant(BIT_FLAGS mode) ((o_ptr->number != 1) ? "were" : "was")); #endif - chg_virtue(p_ptr, V_HARMONY, 1); - chg_virtue(p_ptr, V_ENCHANT, -2); - p_ptr->update |= (PU_BONUS); - p_ptr->window |= (PW_EQUIP | PW_PLAYER); + chg_virtue(target_ptr, V_HARMONY, 1); + chg_virtue(target_ptr, V_ENCHANT, -2); + target_ptr->update |= (PU_BONUS); + target_ptr->window |= (PW_EQUIP | PW_PLAYER); - calc_android_exp(p_ptr); + calc_android_exp(target_ptr); } return (TRUE);