diff options
-rw-r--r-- | crawl-ref/source/actor.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/halo.cc | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h index a542c73306..be566ce97a 100644 --- a/crawl-ref/source/actor.h +++ b/crawl-ref/source/actor.h @@ -202,7 +202,7 @@ public: virtual bool asleep() const { return (false); } virtual bool backlit(bool check_haloed = true) const = 0; - // Within player halo. + // Within any actor's halo? virtual bool haloed() const; // Halo radius. virtual int halo_radius() const = 0; diff --git a/crawl-ref/source/halo.cc b/crawl-ref/source/halo.cc index 152756c7e8..17af683fd2 100644 --- a/crawl-ref/source/halo.cc +++ b/crawl-ref/source/halo.cc @@ -8,10 +8,9 @@ #include "religion.h" #include "terrain.h" -// TODO: generalize. bool actor::haloed() const { - return (you.halo_contains(pos())); + return (!haloers(pos()).empty()); } bool actor::halo_contains(const coord_def &c) const @@ -36,6 +35,9 @@ int monsters::halo_radius() const return 0; } +// XXX: This might become too expensive; possibly, keep +// a mapping of cell -> list of monsters in view of cell +// and just iterate through that. std::list<actor*> haloers(const coord_def &c) { std::list<actor*> ret; @@ -47,4 +49,3 @@ std::list<actor*> haloers(const coord_def &c) } return (ret); } - |