From 9b7e3519e4c96ee62104eb6d515b4df23bbc9a87 Mon Sep 17 00:00:00 2001 From: deskull Date: Tue, 17 Dec 2019 02:15:04 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20project=5Fall=5Flos()=20?= =?utf8?q?=E3=81=AB=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0=EF=BC=8E=20/=20Add=20player=5Ftype=20*=20argu?= =?utf8?q?ment=20to=20project=5Fall=5Flos().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/monster.h | 2 +- src/racial.c | 2 +- src/realm-hex.c | 6 +++--- src/realm-hissatsu.c | 8 ++++---- src/realm-song.c | 6 +++--- src/spells.h | 2 +- src/spells2.c | 58 ++++++++++++++++++++++++++-------------------------- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/monster.h b/src/monster.h index 106139f65..512af56aa 100644 --- a/src/monster.h +++ b/src/monster.h @@ -66,7 +66,7 @@ struct monster_type BIT_FLAGS8 mflag; /* Extra monster flags */ #define MFLAG_VIEW 0x01 /* Monster is in line of sight */ -#define MFLAG_LOS 0x02 /* Monster is marked for project_all_los() */ +#define MFLAG_LOS 0x02 /* Monster is marked for project_all_los(caster_ptr, ) */ #define MFLAG_XXX2 0x04 /* (unused) */ #define MFLAG_ETF 0x08 /* Monster is entering the field. */ #define MFLAG_BORN 0x10 /* Monster is still being born */ diff --git a/src/racial.c b/src/racial.c index c50305e72..76f458341 100644 --- a/src/racial.c +++ b/src/racial.c @@ -519,7 +519,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command) } else if (command == -4) { - project_all_los(GF_CHARM_LIVING, creature_ptr->lev); + project_all_los(creature_ptr, GF_CHARM_LIVING, creature_ptr->lev); } break; } diff --git a/src/realm-hex.c b/src/realm-hex.c index 086045959..f63041a3e 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -406,7 +406,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) if (info) return info_damage(1, power, 0); if (cast || cont) { - project_all_los(GF_POIS, randint1(power)); + project_all_los(caster_ptr, GF_POIS, randint1(power)); } break; @@ -602,7 +602,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) if (info) return info_damage(1, power, 0); if (cast || cont) { - project_all_los(GF_HYPODYNAMIA, randint1(power)); + project_all_los(caster_ptr, GF_HYPODYNAMIA, randint1(power)); } break; @@ -842,7 +842,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) if (info) return info_damage(1, power, 0); if (cast || cont) { - project_all_los(GF_PSI_DRAIN, randint1(power)); + project_all_los(caster_ptr, GF_PSI_DRAIN, randint1(power)); } break; diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 4af93f4e8..859047e98 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -626,7 +626,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo if (cast) { msg_print(_("雄叫びをあげた!", "You roar out!")); - project_all_los(GF_SOUND, randint1(plev * 3)); + project_all_los(caster_ptr, GF_SOUND, randint1(plev * 3)); aggravate_monsters(0); } break; @@ -744,9 +744,9 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo if (cast) { msg_print(_("武器を不規則に揺らした...", "You irregularly wave your weapon...")); - project_all_los(GF_ENGETSU, plev * 4); - project_all_los(GF_ENGETSU, plev * 4); - project_all_los(GF_ENGETSU, plev * 4); + project_all_los(caster_ptr, GF_ENGETSU, plev * 4); + project_all_los(caster_ptr, GF_ENGETSU, plev * 4); + project_all_los(caster_ptr, GF_ENGETSU, plev * 4); } break; diff --git a/src/realm-song.c b/src/realm-song.c index e9d59d308..6ec189750 100644 --- a/src/realm-song.c +++ b/src/realm-song.c @@ -220,7 +220,7 @@ concptr do_music_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) if (cont) { - project_all_los(GF_TURN_ALL, power); + project_all_los(caster_ptr, GF_TURN_ALL, power); } } @@ -340,7 +340,7 @@ concptr do_music_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) if (cont) { - project_all_los(GF_PSI, damroll(dice, sides)); + project_all_los(caster_ptr, GF_PSI, damroll(dice, sides)); } } @@ -446,7 +446,7 @@ concptr do_music_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) if (cont) { - project_all_los(GF_SOUND, damroll(dice, sides)); + project_all_los(caster_ptr, GF_SOUND, damroll(dice, sides)); } } diff --git a/src/spells.h b/src/spells.h index 86d61d4a5..243f4043f 100644 --- a/src/spells.h +++ b/src/spells.h @@ -242,7 +242,7 @@ extern bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev); extern bool mindblast_monsters(HIT_POINT dam); extern bool teleport_swap(DIRECTION dir); extern bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg); -extern bool project_all_los(EFFECT_ID typ, HIT_POINT dam); +extern bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam); extern bool eat_magic(player_type *caster_ptr, int power); extern void discharge_minion(player_type *caster_ptr); extern bool kawarimi(bool success); diff --git a/src/spells2.c b/src/spells2.c index bac5df40e..63b3426a2 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -779,7 +779,7 @@ bool detect_all(POSITION range) * this is done in two passes. -- JDL * */ -bool project_all_los(EFFECT_ID typ, HIT_POINT dam) +bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam) { MONSTER_IDX i; POSITION x, y; @@ -787,25 +787,25 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) bool obvious = FALSE; /* Mark all (nearby) monsters */ - for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) + for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; + monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; y = m_ptr->fy; x = m_ptr->fx; /* Require line of sight */ - if (!player_has_los_bold(p_ptr, y, x) || !projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x)) continue; + if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue; /* Mark the monster */ m_ptr->mflag |= (MFLAG_LOS); } /* Affect all marked monsters */ - for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) + for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; + monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i]; /* Skip unmarked monsters */ if (!(m_ptr->mflag & (MFLAG_LOS))) continue; @@ -817,7 +817,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) x = m_ptr->fx; /* Jump directly to the target monster */ - if (project(p_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE; + if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE; } return (obvious); } @@ -829,7 +829,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) */ bool speed_monsters(void) { - return (project_all_los(GF_OLD_SPEED, p_ptr->lev)); + return (project_all_los(p_ptr, GF_OLD_SPEED, p_ptr->lev)); } /*! @@ -838,7 +838,7 @@ bool speed_monsters(void) */ bool slow_monsters(int power) { - return (project_all_los(GF_OLD_SLOW, power)); + return (project_all_los(p_ptr, GF_OLD_SLOW, power)); } /*! @@ -847,7 +847,7 @@ bool slow_monsters(int power) */ bool sleep_monsters(int power) { - return (project_all_los(GF_OLD_SLEEP, power)); + return (project_all_los(p_ptr, GF_OLD_SLEEP, power)); } /*! @@ -856,7 +856,7 @@ bool sleep_monsters(int power) */ bool banish_evil(int dist) { - return (project_all_los(GF_AWAY_EVIL, dist)); + return (project_all_los(p_ptr, GF_AWAY_EVIL, dist)); } /*! @@ -865,7 +865,7 @@ bool banish_evil(int dist) */ bool turn_undead(void) { - bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev)); + bool tester = (project_all_los(p_ptr, GF_TURN_UNDEAD, p_ptr->lev)); if (tester) chg_virtue(p_ptr, V_UNLIFE, -1); return tester; @@ -877,7 +877,7 @@ bool turn_undead(void) */ bool dispel_undead(HIT_POINT dam) { - bool tester = (project_all_los(GF_DISP_UNDEAD, dam)); + bool tester = (project_all_los(p_ptr, GF_DISP_UNDEAD, dam)); if (tester) chg_virtue(p_ptr, V_UNLIFE, -2); return tester; @@ -889,7 +889,7 @@ bool dispel_undead(HIT_POINT dam) */ bool dispel_evil(HIT_POINT dam) { - return (project_all_los(GF_DISP_EVIL, dam)); + return (project_all_los(p_ptr, GF_DISP_EVIL, dam)); } /*! @@ -898,7 +898,7 @@ bool dispel_evil(HIT_POINT dam) */ bool dispel_good(HIT_POINT dam) { - return (project_all_los(GF_DISP_GOOD, dam)); + return (project_all_los(p_ptr, GF_DISP_GOOD, dam)); } /*! @@ -907,7 +907,7 @@ bool dispel_good(HIT_POINT dam) */ bool dispel_monsters(HIT_POINT dam) { - return (project_all_los(GF_DISP_ALL, dam)); + return (project_all_los(p_ptr, GF_DISP_ALL, dam)); } bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful) @@ -942,7 +942,7 @@ bool unleash_mana_storm(player_type *creature_ptr, bool powerful) */ bool dispel_living(HIT_POINT dam) { - return (project_all_los(GF_DISP_LIVING, dam)); + return (project_all_los(p_ptr, GF_DISP_LIVING, dam)); } /*! @@ -951,7 +951,7 @@ bool dispel_living(HIT_POINT dam) */ bool dispel_demons(HIT_POINT dam) { - return (project_all_los(GF_DISP_DEMON, dam)); + return (project_all_los(p_ptr, GF_DISP_DEMON, dam)); } /*! @@ -960,7 +960,7 @@ bool dispel_demons(HIT_POINT dam) */ bool crusade(void) { - return (project_all_los(GF_CRUSADE, p_ptr->lev*4)); + return (project_all_los(p_ptr, GF_CRUSADE, p_ptr->lev*4)); } /*! @@ -2794,7 +2794,7 @@ void wall_breaker(player_type *caster_ptr) */ bool confuse_monsters(HIT_POINT dam) { - return (project_all_los(GF_OLD_CONF, dam)); + return (project_all_los(p_ptr, GF_OLD_CONF, dam)); } @@ -2805,7 +2805,7 @@ bool confuse_monsters(HIT_POINT dam) */ bool charm_monsters(HIT_POINT dam) { - return (project_all_los(GF_CHARM, dam)); + return (project_all_los(p_ptr, GF_CHARM, dam)); } @@ -2816,7 +2816,7 @@ bool charm_monsters(HIT_POINT dam) */ bool charm_animals(HIT_POINT dam) { - return (project_all_los(GF_CONTROL_ANIMAL, dam)); + return (project_all_los(p_ptr, GF_CONTROL_ANIMAL, dam)); } @@ -2827,7 +2827,7 @@ bool charm_animals(HIT_POINT dam) */ bool stun_monsters(HIT_POINT dam) { - return (project_all_los(GF_STUN, dam)); + return (project_all_los(p_ptr, GF_STUN, dam)); } @@ -2838,7 +2838,7 @@ bool stun_monsters(HIT_POINT dam) */ bool stasis_monsters(HIT_POINT dam) { - return (project_all_los(GF_STASIS, dam)); + return (project_all_los(p_ptr, GF_STASIS, dam)); } @@ -2849,7 +2849,7 @@ bool stasis_monsters(HIT_POINT dam) */ bool mindblast_monsters(HIT_POINT dam) { - return (project_all_los(GF_PSI, dam)); + return (project_all_los(p_ptr, GF_PSI, dam)); } @@ -2860,7 +2860,7 @@ bool mindblast_monsters(HIT_POINT dam) */ bool banish_monsters(int dist) { - return (project_all_los(GF_AWAY_ALL, dist)); + return (project_all_los(p_ptr, GF_AWAY_ALL, dist)); } @@ -2871,7 +2871,7 @@ bool banish_monsters(int dist) */ bool turn_evil(HIT_POINT dam) { - return (project_all_los(GF_TURN_EVIL, dam)); + return (project_all_los(p_ptr, GF_TURN_EVIL, dam)); } @@ -2882,7 +2882,7 @@ bool turn_evil(HIT_POINT dam) */ bool turn_monsters(HIT_POINT dam) { - return (project_all_los(GF_TURN_ALL, dam)); + return (project_all_los(p_ptr, GF_TURN_ALL, dam)); } @@ -2892,7 +2892,7 @@ bool turn_monsters(HIT_POINT dam) */ bool deathray_monsters(void) { - return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200)); + return (project_all_los(p_ptr, GF_DEATH_RAY, p_ptr->lev * 200)); } /*! -- 2.11.0