From bf9183f6523bf96750b50723fc0f783af6fc8e9c Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Thu, 12 Nov 2009 08:33:03 +0100 Subject: More monster_iterator conversions. --- crawl-ref/source/mon-behv.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/mon-behv.cc') 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; -- cgit v1.2.3-54-g00ecf