summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/los.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-16 23:48:56 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-16 23:49:51 +0200
commitf6e6b6b7151af9290c0597acb1995ed157378529 (patch)
treec984c3816cc6a66118b8fc47b6e6984f1b1eba4d /crawl-ref/source/los.cc
parent756894ef3f3dd9c70af6115be117bb09e4374342 (diff)
downloadcrawl-ref-f6e6b6b7151af9290c0597acb1995ed157378529.tar.gz
crawl-ref-f6e6b6b7151af9290c0597acb1995ed157378529.zip
Rewrite cell_see_cell using exists_ray.
For this, add new opacity_func that disregards half-opaque things.
Diffstat (limited to 'crawl-ref/source/los.cc')
-rw-r--r--crawl-ref/source/los.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc
index 38de458419..9dbe3bc23d 100644
--- a/crawl-ref/source/los.cc
+++ b/crawl-ref/source/los.cc
@@ -775,14 +775,10 @@ int num_feats_between(const coord_def& source, const coord_def& target,
return (count);
}
-// Is p2 visible from p1, disregarding clouds?
-// XXX: Horribly inefficient since we do an entire LOS calculation;
-// needs to be rewritten if it is used more.
+// Is p2 visible from p1, disregarding half-opaque objects?
bool cell_see_cell(const coord_def& p1, const coord_def& p2)
{
- env_show_grid show;
- losight(show, p1);
- return see_grid(show, p1, p2);
+ return exists_ray(p1, p2, opc_fullyopaque);
}
// We use raycasting. The algorithm: