diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-12 08:33:03 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-12 09:38:15 +0100 |
commit | bf9183f6523bf96750b50723fc0f783af6fc8e9c (patch) | |
tree | 0833c35f8b11d3f57ea22c57bcce48a15cf5319e /crawl-ref/source/mon-behv.cc | |
parent | a32d122dd8d29cf5982ac1052d9c88c91ce0bcd3 (diff) | |
download | crawl-ref-bf9183f6523bf96750b50723fc0f783af6fc8e9c.tar.gz crawl-ref-bf9183f6523bf96750b50723fc0f783af6fc8e9c.zip |
More monster_iterator conversions.
Diffstat (limited to 'crawl-ref/source/mon-behv.cc')
-rw-r--r-- | crawl-ref/source/mon-behv.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index 7883a367b1..03ae622bb9 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -15,6 +15,7 @@ #include "fprop.h" #include "exclude.h" #include "los.h" +#include "mon-iter.h" #include "mon-place.h" #include "mon-stuff.h" #include "mon-util.h" @@ -914,13 +915,13 @@ static void _arena_set_foe(monsters *mons) int nearest_unseen = -1; int best_unseen_distance = -1; - for (int i = 0; i < MAX_MONSTERS; ++i) + for (monster_iterator other; other; ++other) { + int i = other->mindex(); if (mind == i) continue; - const monsters *other(&menv[i]); - if (!other->alive() || mons_aligned(mind, i)) + if (mons_aligned(mind, i)) continue; // Don't fight test spawners, since they're only pseudo-monsters @@ -934,7 +935,7 @@ static void _arena_set_foe(monsters *mons) } const int distance = grid_distance(mons->pos(), other->pos()); - const bool seen = mons->can_see(other); + const bool seen = mons->can_see(*other); if (seen) { @@ -954,7 +955,7 @@ static void _arena_set_foe(monsters *mons) } if ((best_distance == -1 || distance < best_distance) - && mons->can_see(other)) + && mons->can_see(*other)) { best_distance = distance; |