summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/losparam.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-17 17:20:30 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-17 17:36:45 +0200
commitb151b68bd42450a4c6fccf4fbb295bd6e504f968 (patch)
treec47352b147ef78e4a4c9f6b74c56a3876beef521 /crawl-ref/source/losparam.h
parent86adff1f485882e2495f711b4b19fbdb41db0ca7 (diff)
downloadcrawl-ref-b151b68bd42450a4c6fccf4fbb295bd6e504f968.tar.gz
crawl-ref-b151b68bd42450a4c6fccf4fbb295bd6e504f968.zip
Replace monster_los by calls to losight.
los_param got a new opacity_monmove to help. The change compiles and the game runs, but I'm unsure how to test monster pathfinding. Please tell me if anything went wrong! Removes mon-los.{cc,h}, so I'm afraid I may have broken the non-Unix builds again.
Diffstat (limited to 'crawl-ref/source/losparam.h')
-rw-r--r--crawl-ref/source/losparam.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/crawl-ref/source/losparam.h b/crawl-ref/source/losparam.h
index 8818f3a7d8..7a152a0225 100644
--- a/crawl-ref/source/losparam.h
+++ b/crawl-ref/source/losparam.h
@@ -52,6 +52,19 @@ struct opacity_solid : opacity_func
};
static opacity_solid opc_solid;
+// Opacity for monster movement, based on the late monster_los.
+struct opacity_monmove : opacity_func
+{
+ const monsters& mon;
+
+ opacity_monmove(const monsters& m)
+ : mon(m)
+ {
+ }
+
+ opacity_type operator()(const coord_def& p) const;
+};
+
// LOS bounded by fixed presquared radius.
struct bounds_radius_sq : bounds_func
{
@@ -60,8 +73,18 @@ struct bounds_radius_sq : bounds_func
: radius_sq(r_sq) {}
bool operator()(const coord_def& p) const;
};
-static bounds_radius_sq bds_deflos = bounds_radius_sq(LOS_RADIUS_SQ);
-static bounds_radius_sq bds_maxlos = bounds_radius_sq(LOS_MAX_RADIUS_SQ);
+
+// LOS bounded by fixed radius.
+struct bounds_radius : bounds_radius_sq
+{
+ bounds_radius(int r)
+ : bounds_radius_sq(r * r + 1)
+ {
+ }
+};
+
+static bounds_radius bds_deflos = bounds_radius(LOS_RADIUS);
+static bounds_radius bds_maxlos = bounds_radius(LOS_MAX_RADIUS);
// LOS bounded by current global LOS radius.
struct bounds_cur_los_radius : bounds_func