summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-08 10:22:51 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-08 10:22:51 +0100
commit0ccae520b8691c5bb0188449c7c53b8e4f6d130c (patch)
tree5fb5764d2712c4d98a81073dff7565a4c95a5146 /crawl-ref/source
parent0869a80df1986501c68f608d71aaac4acea882dc (diff)
downloadcrawl-ref-0ccae520b8691c5bb0188449c7c53b8e4f6d130c.tar.gz
crawl-ref-0ccae520b8691c5bb0188449c7c53b8e4f6d130c.zip
actor::haloed() now returns whether the actor is within any halo.
This may not always be what is meant.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/actor.h2
-rw-r--r--crawl-ref/source/halo.cc7
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);
}
-