diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-10 16:13:47 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-10 16:13:47 +0200 |
commit | 5c34915cca26244d2eeea2d3672c04a74ad28e5f (patch) | |
tree | 23ec19736201313e060dc6e5525163319f0bb55b /crawl-ref/source/ray.cc | |
parent | 34c799465978d8d72daf7d5b5b42e7057ab6d84f (diff) | |
download | crawl-ref-5c34915cca26244d2eeea2d3672c04a74ad28e5f.tar.gz crawl-ref-5c34915cca26244d2eeea2d3672c04a74ad28e5f.zip |
Fix bug in ray_def::footprint.
footprint was trampling on the ray's starting position.
Diffstat (limited to 'crawl-ref/source/ray.cc')
-rw-r--r-- | crawl-ref/source/ray.cc | 10 |
1 files changed, 6 insertions, 4 deletions
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<int>(accx); - cury = static_cast<int>(accy); + _find_next_intercept(&ax, &ay, slope); + curx = static_cast<int>(ax); + cury = static_cast<int>(ay); if (curx*curx + cury*cury > radius2) break; @@ -339,4 +342,3 @@ int ray_def::footprint(int radius2, int xpos[], int ypos[]) } return cellnum; } - |