From 0a624bcd948148817226c9585db7ce16bf5cb599 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Fri, 16 Oct 2009 11:00:40 +0200 Subject: 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. --- crawl-ref/source/beam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crawl-ref/source/beam.cc') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 50a9a87ff4..fc7c8d2d98 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1592,7 +1592,7 @@ void bolt::choose_ray() { if (!chose_ray || reflections > 0) { - if (!find_ray(source, target, ray, 0, true)) + if (!find_ray(source, target, ray)) fallback_ray(source, target, ray); } } -- cgit v1.2.3-54-g00ecf