summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-21 11:14:07 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-21 11:20:30 +0100
commit0f564ac5ed46902bd3a7b733c01db8842643d3ad (patch)
tree6f60f73f627a21ccc3978e6ab18ca9d3e7f15641 /crawl-ref
parent2fb6a7e3d921cde7222b816bda2aaf161005371a (diff)
downloadcrawl-ref-0f564ac5ed46902bd3a7b733c01db8842643d3ad.tar.gz
crawl-ref-0f564ac5ed46902bd3a7b733c01db8842643d3ad.zip
Merge halo.cc into areas.cc.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/areas.cc49
-rw-r--r--crawl-ref/source/areas.h3
-rw-r--r--crawl-ref/source/halo.cc56
-rw-r--r--crawl-ref/source/halo.h8
-rw-r--r--crawl-ref/source/makefile.obj1
-rw-r--r--crawl-ref/source/show.cc2
-rw-r--r--crawl-ref/source/showsymb.cc2
7 files changed, 54 insertions, 67 deletions
diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc
index 43dc1e4b97..7477f83180 100644
--- a/crawl-ref/source/areas.cc
+++ b/crawl-ref/source/areas.cc
@@ -23,6 +23,7 @@
#include "player.h"
#include "religion.h"
#include "stuff.h"
+#include "terrain.h"
#include "traps.h"
#include "travel.h"
#include "viewgeom.h"
@@ -255,3 +256,51 @@ bool silenced(const coord_def& p)
return (you.duration[DUR_SILENCE] && distance(p, you.pos()) <= 6*6 + 1);
}
+/////////////
+// Halos
+
+bool actor::haloed() const
+{
+ return (you.halo_contains(pos()));
+}
+
+bool actor::halo_contains(const coord_def &c) const
+{
+ int r = halo_radius();
+ return (r > 0 && (c - pos()).abs() <= r * r && see_cell(c));
+}
+
+int player::halo_radius() const
+{
+ if (you.religion == GOD_SHINING_ONE && you.piety >= piety_breakpoint(0)
+ && !you.penance[GOD_SHINING_ONE])
+ {
+ return (std::min(LOS_RADIUS, you.piety / 20));
+ }
+
+ return (0);
+}
+
+int monsters::halo_radius() const
+{
+ // Angels and Daevas are haloed.
+ if (holiness() == MH_HOLY)
+ return (2);
+ else
+ 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;
+ for (radius_iterator ri(c, LOS_RADIUS, false); ri; ++ri)
+ {
+ actor* a = actor_at(*ri);
+ if (a && a->halo_contains(c))
+ ret.push_back(a);
+ }
+ return (ret);
+}
diff --git a/crawl-ref/source/areas.h b/crawl-ref/source/areas.h
index a2da7eebb0..693b349007 100644
--- a/crawl-ref/source/areas.h
+++ b/crawl-ref/source/areas.h
@@ -7,5 +7,8 @@ void decrease_sanctuary_radius();
bool silenced(const coord_def& p);
+// Actors within whose halo the given point is.
+std::list<actor*> haloers(const coord_def &c);
+
#endif
diff --git a/crawl-ref/source/halo.cc b/crawl-ref/source/halo.cc
deleted file mode 100644
index a71447ac2b..0000000000
--- a/crawl-ref/source/halo.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "AppHdr.h"
-
-#include "halo.h"
-
-#include "actor.h"
-#include "coordit.h"
-#include "player.h"
-#include "monster.h"
-#include "religion.h"
-#include "terrain.h"
-
-bool actor::haloed() const
-{
- return (you.halo_contains(pos()));
-}
-
-bool actor::halo_contains(const coord_def &c) const
-{
- int r = halo_radius();
- return (r > 0 && (c - pos()).abs() <= r * r && see_cell(c));
-}
-
-int player::halo_radius() const
-{
- if (you.religion == GOD_SHINING_ONE && you.piety >= piety_breakpoint(0)
- && !you.penance[GOD_SHINING_ONE])
- {
- return (std::min(LOS_RADIUS, you.piety / 20));
- }
-
- return (0);
-}
-
-int monsters::halo_radius() const
-{
- // Angels and Daevas are haloed.
- if (holiness() == MH_HOLY)
- return (2);
- else
- 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;
- for (radius_iterator ri(c, LOS_RADIUS, false); ri; ++ri)
- {
- actor* a = actor_at(*ri);
- if (a && a->halo_contains(c))
- ret.push_back(a);
- }
- return (ret);
-}
diff --git a/crawl-ref/source/halo.h b/crawl-ref/source/halo.h
deleted file mode 100644
index 6f1bb4606b..0000000000
--- a/crawl-ref/source/halo.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef HALO_H
-#define HALO_H
-
-// Actors within whose halo the given point is.
-std::list<actor*> haloers(const coord_def &c);
-
-#endif
-
diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj
index 28028d1be2..5fe2ea5020 100644
--- a/crawl-ref/source/makefile.obj
+++ b/crawl-ref/source/makefile.obj
@@ -47,7 +47,6 @@ ghost.o \
godabil.o \
goditem.o \
godwrath.o \
-halo.o \
hiscores.o \
initfile.o \
invent.o \
diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc
index 99839781d6..2836c7ace7 100644
--- a/crawl-ref/source/show.cc
+++ b/crawl-ref/source/show.cc
@@ -4,11 +4,11 @@
#include "show.h"
+#include "areas.h"
#include "cloud.h"
#include "coordit.h"
#include "env.h"
#include "fprop.h"
-#include "halo.h"
#include "itemprop.h"
#include "mon-util.h"
#include "monster.h"
diff --git a/crawl-ref/source/showsymb.cc b/crawl-ref/source/showsymb.cc
index 8e66b5f33a..1d3c4e7dae 100644
--- a/crawl-ref/source/showsymb.cc
+++ b/crawl-ref/source/showsymb.cc
@@ -12,11 +12,11 @@
#include <stdint.h> // For uint32_t
+#include "areas.h"
#include "colour.h"
#include "env.h"
#include "map_knowledge.h"
#include "fprop.h"
-#include "halo.h"
#include "mon-util.h"
#include "monster.h"
#include "options.h"