diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-10-31 08:16:07 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-10-31 16:57:54 +0100 |
commit | a57962fa1975ecc27863c2f847fa2a1c4484f7fa (patch) | |
tree | 7e5055301b3554b4598be94b52b65633fea156dc /crawl-ref/source/spl-clouds.cc | |
parent | b5aec581b1ad18e6eefb77947e822c089f778d6f (diff) | |
download | crawl-ref-a57962fa1975ecc27863c2f847fa2a1c4484f7fa.tar.gz crawl-ref-a57962fa1975ecc27863c2f847fa2a1c4484f7fa.zip |
monster_near_iterator
Does the "in view" part of functionality of monster_iterator, is simpler,
allows using los models other than LOS_DEFAULT, and gets rid of a lot of
uses of get_los().
The code is nearly identical as actor_near_iterator, but the old delegation
used more code than either of those. Still, perhaps templating could work?
This commit also fixes a buttload of ignoring invis / see invis / sense invis
(ie, visible_to()) and act-through-glass bugs.
Diffstat (limited to 'crawl-ref/source/spl-clouds.cc')
-rw-r--r-- | crawl-ref/source/spl-clouds.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crawl-ref/source/spl-clouds.cc b/crawl-ref/source/spl-clouds.cc index 0f4a960746..200be11930 100644 --- a/crawl-ref/source/spl-clouds.cc +++ b/crawl-ref/source/spl-clouds.cc @@ -476,18 +476,18 @@ void apply_control_winds(const monster* mon) } // Now give a ranged accuracy boost to nearby allies - for (monster_iterator mi(mon); mi; ++mi) + for (monster_near_iterator mi(mon, LOS_NO_TRANS); mi; ++mi) { - if (distance2(mon->pos(), mi->pos()) < 33 && mons_aligned(mon, *mi)) + if (distance2(mon->pos(), mi->pos()) >= 33 || !mons_aligned(mon, *mi)) + continue; + + if (!mi->has_ench(ENCH_WIND_AIDED)) + mi->add_ench(mon_enchant(ENCH_WIND_AIDED, 1, mon, 20)); + else { - if (!mi->has_ench(ENCH_WIND_AIDED)) - mi->add_ench(mon_enchant(ENCH_WIND_AIDED, 1, mon, 20)); - else - { - mon_enchant aid = mi->get_ench(ENCH_WIND_AIDED); - aid.duration = 20; - mi->update_ench(aid); - } + mon_enchant aid = mi->get_ench(ENCH_WIND_AIDED); + aid.duration = 20; + mi->update_ench(aid); } } } |