summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/los.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-12-02 04:23:32 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-12-03 11:02:04 +0100
commita248abcac039dda36919e2e8882f83b04685eca1 (patch)
treecca965406e217c5af20c62380cdd700ea6d8f905 /crawl-ref/source/los.cc
parentada52c5036588e8fe63c87b5bb98b1848fdde539 (diff)
downloadcrawl-ref-a248abcac039dda36919e2e8882f83b04685eca1.tar.gz
crawl-ref-a248abcac039dda36919e2e8882f83b04685eca1.zip
Use a scalar range for find_ray() and friends instead of a circle_def object.
Diffstat (limited to 'crawl-ref/source/los.cc')
-rw-r--r--crawl-ref/source/los.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc
index 83dc65d89c..f695cfbb33 100644
--- a/crawl-ref/source/los.cc
+++ b/crawl-ref/source/los.cc
@@ -547,13 +547,12 @@ void cellray::calc_params()
// opc has been translated for this quadrant.
// XXX: Allow finding ray of minimum opacity.
static bool _find_ray_se(const coord_def& target, ray_def& ray,
- const opacity_func& opc, const circle_def& bds,
- bool cycle)
+ const opacity_func& opc, int range, bool cycle)
{
ASSERT(target.x >= 0);
ASSERT(target.y >= 0);
ASSERT(!target.origin());
- if (!bds.contains(target))
+ if (target.abs() > range * range + 1)
return false;
ASSERT(target.abs() <= LOS_RADIUS_SQ);
@@ -625,7 +624,7 @@ struct opacity_trans : public opacity_func
// assume that ray is appropriately filled in, and look for the next
// ray. We only ever use ray.cycle_idx.
bool find_ray(const coord_def& source, const coord_def& target,
- ray_def& ray, const opacity_func& opc, const circle_def &bds,
+ ray_def& ray, const opacity_func& opc, int range,
bool cycle)
{
if (target == source || !map_bounds(source) || !map_bounds(target))
@@ -638,7 +637,7 @@ bool find_ray(const coord_def& source, const coord_def& target,
const coord_def abs = coord_def(absx, absy);
opacity_trans opc_trans = opacity_trans(opc, source, signx, signy);
- if (!_find_ray_se(abs, ray, opc_trans, bds, cycle))
+ if (!_find_ray_se(abs, ray, opc_trans, range, cycle))
return false;
if (signx < 0)
@@ -655,10 +654,10 @@ bool find_ray(const coord_def& source, const coord_def& target,
}
bool exists_ray(const coord_def& source, const coord_def& target,
- const opacity_func& opc, const circle_def &bds)
+ const opacity_func& opc, int range)
{
ray_def ray;
- return find_ray(source, target, ray, opc, bds);
+ return find_ray(source, target, ray, opc, range);
}
// Assuming that target is in view of source, but line of