summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/los.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-10 12:26:58 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-10 12:26:58 +0200
commit28112f6099b94dff010198d6b3cbf33d40219a7e (patch)
tree73ea07a4a36b0f67b00ce993a2abba0026c4b608 /crawl-ref/source/los.cc
parent32f7f9c05634d9442ccdc6fcc9bda35ab1f682d7 (diff)
downloadcrawl-ref-28112f6099b94dff010198d6b3cbf33d40219a7e.tar.gz
crawl-ref-28112f6099b94dff010198d6b3cbf33d40219a7e.zip
Move shoot_ray into ray_def.
Diffstat (limited to 'crawl-ref/source/los.cc')
-rw-r--r--crawl-ref/source/los.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc
index d8a24b1582..a7be8eca4d 100644
--- a/crawl-ref/source/los.cc
+++ b/crawl-ref/source/los.cc
@@ -54,7 +54,10 @@ void clear_rays_on_exit()
delete[] los_blockrays;
}
-int _los_radius_squared = LOS_RADIUS * LOS_RADIUS + 1;
+// pre-squared LOS radius
+#define LOS_RADIUS2 (LOS_RADIUS * LOS_RADIUS + 1)
+
+int _los_radius_squared = LOS_RADIUS2;
void setLOSRadius(int newLR)
{
@@ -201,7 +204,9 @@ static std::vector<int> _find_nonduped_cellrays()
static bool _register_ray( double accx, double accy, double slope )
{
int xpos[LOS_MAX_RANGE * 2 + 1], ypos[LOS_MAX_RANGE * 2 + 1];
- int raylen = shoot_ray(accx, accy, slope, LOS_MAX_RANGE, xpos, ypos);
+ ray_def ray = ray_def(accx, accy, slope, 0);
+ // find out which cells the ray passes through
+ int raylen = ray.footprint(LOS_RADIUS2, xpos, ypos);
// Early out if ray already exists.
if (_is_duplicate_ray(raylen, xpos, ypos))
@@ -217,11 +222,6 @@ static bool _register_ray( double accx, double accy, double slope )
// Register the fullray.
raylengths.push_back(raylen);
- ray_def ray;
- ray.accx = accx;
- ray.accy = accy;
- ray.slope = slope;
- ray.quadrant = 0;
fullrays.push_back(ray);
return (true);