summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/losparam.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-08 22:40:29 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-08 22:45:29 +0200
commitd87a308f449bb959db24495e2a1dc307924bc8ae (patch)
tree0f8a71bea75914d2351e45daa08345aba547121b /crawl-ref/source/losparam.cc
parent9cc7466db06f418c165ed79fd6bfdfe334a6a568 (diff)
downloadcrawl-ref-d87a308f449bb959db24495e2a1dc307924bc8ae.tar.gz
crawl-ref-d87a308f449bb959db24495e2a1dc307924bc8ae.zip
Split and correct grid_see_grid.
There's now cell_see_cell which tests for visibility correctly, albeit slowly. That's only used for placing features in the abyss currently, but needs to be improved if it gets used more. The second function used in monster movement was left as is, but renamed to can_go_straight. This remains unreliable but probably serves its purpose. The grid_see_grid test is adapted to cell_see_cell; the grid_see_grid lua binding is now actually useful. Also reduce the number of tests in los_csc and los_symm.
Diffstat (limited to 'crawl-ref/source/losparam.cc')
-rw-r--r--crawl-ref/source/losparam.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc
index 85e0954499..cd746d0b58 100644
--- a/crawl-ref/source/losparam.cc
+++ b/crawl-ref/source/losparam.cc
@@ -50,23 +50,40 @@ opacity_type los_param_permissive::opacity(const coord_def& p) const
}
-/* los_param_base */
+/* los_param_nocloud */
-los_param_base::los_param_base(const coord_def& c)
+los_param_nocloud::los_param_nocloud(const coord_def& c)
: los_param_trans(c)
{
}
-dungeon_feature_type los_param_base::feature(const coord_def& p) const
+dungeon_feature_type los_param_nocloud::feature(const coord_def& p) const
{
return env.grid(trans(p));
}
-unsigned los_param_base::appearance(const coord_def& p) const
+unsigned los_param_nocloud::appearance(const coord_def& p) const
{
return grid_appearance(trans(p));
}
+opacity_type los_param_nocloud::opacity(const coord_def& p) const
+{
+ dungeon_feature_type f = feature(p);
+ if (grid_is_opaque(f))
+ return OPC_OPAQUE;
+ else
+ return OPC_CLEAR;
+}
+
+
+/* los_param_base */
+
+los_param_base::los_param_base(const coord_def& c)
+ : los_param_nocloud(c)
+{
+}
+
unsigned short los_param_base::cloud_idx(const coord_def& p) const
{
return env.cgrid(trans(p));