diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-11 16:25:49 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-11 16:26:21 +0100 |
commit | 24636262aded779e9759895c536e0f42f79c4b52 (patch) | |
tree | c59d33f80ce08162fb552ac1ec4e21c9b0926f25 /crawl-ref/source/religion.cc | |
parent | 113f5584b48b69fef94af676af6b0f5bb3cf1c64 (diff) | |
download | crawl-ref-24636262aded779e9759895c536e0f42f79c4b52.tar.gz crawl-ref-24636262aded779e9759895c536e0f42f79c4b52.zip |
Convert some more monster loops to monster_iterator.
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 6a4c05fee1..dd00639ef6 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -52,6 +52,7 @@ #include "message.h" #include "misc.h" #include "mon-behv.h" +#include "mon-iter.h" #include "mon-util.h" #include "monplace.h" #include "monstuff.h" @@ -1421,13 +1422,9 @@ bool _has_jelly() { ASSERT(you.religion == GOD_JIYVA); - for (int i = 0; i < MAX_MONSTERS; ++i) - { - monsters *monster = &menv[i]; - if (mons_is_god_gift(monster, GOD_JIYVA)) + for (monster_iterator mi; mi; ++mi) + if (mons_is_god_gift(*mi, GOD_JIYVA)) return (true); - } - return (false); } @@ -5446,10 +5443,8 @@ int get_tension(god_type god, bool count_travelling) int total = 0; bool nearby_monster = false; - for (int midx = 0; midx < MAX_MONSTERS; ++midx) + for (monster_iterator mons; mons; ++mons) { - const monsters* mons = &menv[midx]; - if (!mons->alive()) continue; @@ -5479,14 +5474,14 @@ int get_tension(god_type god, bool count_travelling) continue; } - const mon_attitude_type att = mons_attitude(mons); + const mon_attitude_type att = mons_attitude(*mons); if (att == ATT_GOOD_NEUTRAL || att == ATT_NEUTRAL) continue; - if (mons->cannot_act() || mons->asleep() || mons_is_fleeing(mons)) + if (mons->cannot_act() || mons->asleep() || mons_is_fleeing(*mons)) continue; - int exper = exper_value(mons); + int exper = exper_value(*mons); if (exper <= 0) continue; @@ -5494,7 +5489,7 @@ int get_tension(god_type god, bool count_travelling) exper *= mons->hit_points; exper /= mons->max_hit_points; - const bool gift = mons_is_god_gift(mons, god); + const bool gift = mons_is_god_gift(*mons, god); if (att == ATT_HOSTILE) { @@ -5517,7 +5512,7 @@ int get_tension(god_type god, bool count_travelling) if (att != ATT_FRIENDLY) { - if (!you.visible_to(mons)) + if (!you.visible_to(*mons)) exper /= 2; if (!mons->visible_to(&you)) exper *= 2; |