summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-13 21:33:23 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-13 21:33:23 +0000
commit36cb1e6187e1826c345597eec2afff77e83988d6 (patch)
tree9f6d5b5211744da44e7e41a000709fbfb7a5d59c /crawl-ref/source/view.cc
parenta71e775e717dafe7504d13839dae7d94c40fe1da (diff)
downloadcrawl-ref-36cb1e6187e1826c345597eec2afff77e83988d6.tar.gz
crawl-ref-36cb1e6187e1826c345597eec2afff77e83988d6.zip
Fix 1992604: monster_los asserting for positions out of bounds.
Mark bees created in bee hives as patrolling. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5789 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r--crawl-ref/source/view.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index a14738ea47..e0ca6d1eea 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -5682,6 +5682,13 @@ void monster_los::check_los_beam(int dx, int dy)
for (int tx = target1_x; tx <= target2_x; tx++)
for (int ty = target1_y; ty <= target2_y; ty++)
{
+ // If (tx, ty) lies outside the level boundaries, there's nothing
+ // that shooting a ray into that direction could bring us, esp.
+ // as earlier grids in the ray will already have been handled, and
+ // out of bounds grids are simply skipped in any LoS check.
+ if (!map_bounds(tx, ty));
+ continue;
+
// Already calculated a beam to (tx, ty), don't do so again.
if (!is_unknown(tx, ty))
continue;
@@ -5690,13 +5697,17 @@ void monster_los::check_los_beam(int dx, int dy)
ray.fullray_idx = -1; // to quiet valgrind
find_ray( gridx, gridy, tx, ty, true, ray, 0, true, true );
- ASSERT(in_bounds(ray.x(), ray.y()));
if (ray.x() == gridx && ray.y() == gridy)
ray.advance(true);
while (dist++ <= max_dist)
{
- ASSERT(in_bounds(ray.x(), ray.y()));
+ // The ray brings is out of bounds of the level map.
+ // Since we're always shooting outwards there's nothing more
+ // to look at in that direction, and we can break the loop.
+ if (!map_bounds(ray.x(), ray.y()))
+ break;
+
if (blocked)
{
// Earlier grid blocks this beam, set to blocked if