summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_los.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-16 11:00:40 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-16 16:09:28 +0200
commit0a624bcd948148817226c9585db7ce16bf5cb599 (patch)
tree4776ca7d42aae270582e779e8568ec3bb8c12efe /crawl-ref/source/l_los.cc
parent8ba1550e401b3b67a046e2173b4143c8f51bd933 (diff)
downloadcrawl-ref-0a624bcd948148817226c9585db7ce16bf5cb599.tar.gz
crawl-ref-0a624bcd948148817226c9585db7ce16bf5cb599.zip
Rewrite find_ray to use precomputed cellrays.
During precomputation, we store the minimal cellrays by target and sort them according to niceness. find_ray now simply picks the first non-blocked ray to a target, which means looping through the 10 or so minimal cellrays with that target -- this should be a lot more efficient. (An extended findray test went from 150s to 40s (debug) and 40s to 26s (profile)). The interface to find_ray has changed: cycle_dir=-1,0,1 was changed to cyle=false/true since we never cycle in the other direction anyway. find_shortest was removed: all rays to a target had the same length all along, but now we also return the straightest one automatically. The change also eliminates the duplicate corner-cutting code between ray_def::advance and find_ray as imbalance calculation now relies on ray_def::advance.
Diffstat (limited to 'crawl-ref/source/l_los.cc')
-rw-r--r--crawl-ref/source/l_los.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/crawl-ref/source/l_los.cc b/crawl-ref/source/l_los.cc
index 3d4c38f498..1ac2f9a3c7 100644
--- a/crawl-ref/source/l_los.cc
+++ b/crawl-ref/source/l_los.cc
@@ -25,7 +25,7 @@ LUAFN(los_find_ray)
GETCOORD(a, 1, 2, map_bounds);
GETCOORD(b, 3, 4, map_bounds);
ray_def *ray = new ray_def;
- if (find_ray(a, b, *ray, 0, true))
+ if (find_ray(a, b, *ray))
{
lua_push_ray(ls, ray);
return (1);