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/los.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'crawl-ref/source/los.h') diff --git a/crawl-ref/source/los.h b/crawl-ref/source/los.h index d448037c7e..045534ac4e 100644 --- a/crawl-ref/source/los.h +++ b/crawl-ref/source/los.h @@ -19,8 +19,7 @@ int get_los_radius_squared(); // XXX struct ray_def; bool find_ray(const coord_def& source, const coord_def& target, - ray_def& ray, int cycle_dir = 0, bool find_shortest = false, - bool ignore_solid = false); + ray_def& ray, bool cycle = false, bool ignore_solid = false); void fallback_ray(const coord_def& source, const coord_def& target, ray_def& ray); -- cgit v1.2.3-54-g00ecf