From afca77968d2a0591591a1b0792b2083558d6c3bc Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 31 Oct 2009 09:19:11 +0100 Subject: Special case source==target in num_feats_between. This was causing a crash through monsters::mon_see_cell. Also special case monster position there. --- crawl-ref/source/los.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crawl-ref/source/los.cc') diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index 282ddba85c..cff3c128be 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -752,6 +752,9 @@ int num_feats_between(const coord_def& source, const coord_def& target, int count = 0; int max_dist = grid_distance(source, target); + if (source == target) + return (0); // XXX: might want to count the cell. + // We don't need to find the shortest beam, any beam will suffice. fallback_ray(source, target, ray); -- cgit v1.2.3-54-g00ecf