From 5c34915cca26244d2eeea2d3672c04a74ad28e5f Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 10 Oct 2009 16:13:47 +0200 Subject: Fix bug in ray_def::footprint. footprint was trampling on the ray's starting position. --- crawl-ref/source/ray.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/ray.cc') diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc index 5db398f4e4..cb9117de62 100644 --- a/crawl-ref/source/ray.cc +++ b/crawl-ref/source/ray.cc @@ -324,13 +324,16 @@ int ray_def::raw_advance() // return the number of cells visited. int ray_def::footprint(int radius2, int xpos[], int ypos[]) { + // copy starting point + double ax = accx; + double ay = accy; int curx, cury; int cellnum; for (cellnum = 0; true; ++cellnum) { - _find_next_intercept(&accx, &accy, slope); - curx = static_cast(accx); - cury = static_cast(accy); + _find_next_intercept(&ax, &ay, slope); + curx = static_cast(ax); + cury = static_cast(ay); if (curx*curx + cury*cury > radius2) break; @@ -339,4 +342,3 @@ int ray_def::footprint(int radius2, int xpos[], int ypos[]) } return cellnum; } - -- cgit v1.2.3-54-g00ecf