summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-11 15:01:53 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-11 16:26:21 +0100
commit730293f79740586678d8fd212313903f426757c1 (patch)
tree9a5c52499f3ca0c9e534d904a3af43e5f980cc5a /crawl-ref/source/spells2.cc
parent9c2352a57959f8a33fb429ff16add251d5cd559f (diff)
downloadcrawl-ref-730293f79740586678d8fd212313903f426757c1.tar.gz
crawl-ref-730293f79740586678d8fd212313903f426757c1.zip
Convert cast_toxic_radiance to use monster_iterator.
Testing monster_iterator functionality.
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 57293bf40d..0f9df1d37b 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -33,6 +33,7 @@
#include "message.h"
#include "misc.h"
#include "mon-behv.h"
+#include "mon-iter.h"
#include "monplace.h"
#include "monstuff.h"
#include "mon-util.h"
@@ -531,31 +532,29 @@ void cast_toxic_radiance()
counted_monster_list affected_monsters;
// determine which monsters are hit by the radiance: {dlb}
- for (int i = 0; i < MAX_MONSTERS; ++i)
+ for (monster_iterator mi(&you.get_los()); mi; ++mi)
{
- monsters* const monster = &menv[i];
-
- if (monster->alive() && mons_near(monster) && !monster->submerged())
+ if (!mi->submerged())
{
// Monsters affected by corona are still invisible in that
// radiation passes through them without affecting them. Therefore,
// this check should not be !monster->invisible().
- if (!monster->has_ench(ENCH_INVIS))
+ if (!mi->has_ench(ENCH_INVIS))
{
bool affected =
- poison_monster(monster, KC_YOU, 1, false, false);
+ poison_monster(*mi, KC_YOU, 1, false, false);
- if (coinflip() && poison_monster(monster, KC_YOU, false, false))
+ if (coinflip() && poison_monster(*mi, KC_YOU, false, false))
affected = true;
if (affected)
- _record_monster_by_name(affected_monsters, monster);
+ _record_monster_by_name(affected_monsters, *mi);
}
else if (you.can_see_invisible())
{
// message player re:"miss" where appropriate {dlb}
mprf("The light passes through %s.",
- monster->name(DESC_NOCAP_THE).c_str());
+ mi->name(DESC_NOCAP_THE).c_str());
}
}
}