summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/areas.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-02-23 20:00:19 -0500
committerNeil Moore <neil@s-z.org>2014-02-23 20:02:50 -0500
commitc2328442afdce263a890bf45d22657b10cd4bbe3 (patch)
tree88b01dc299ba4571bb7019085cab7e8ecfe839ec /crawl-ref/source/areas.cc
parent7f5c0d692c6173e5e05734313882f1d5fbe9afcf (diff)
downloadcrawl-ref-c2328442afdce263a890bf45d22657b10cd4bbe3.tar.gz
crawl-ref-c2328442afdce263a890bf45d22657b10cd4bbe3.zip
Don't crash when sanctuary shrinks near the map edge
See for example: http://crawl.lantea.net/crawl/morgue/letownia/crash-letownia-20140224-004021.txt Introduced by 0.14-a0-622-g0c137b5, which replaced radius_iterator with C_SQUARE by rectangle_iterator. Unfortunately, the latter did not clip the iterator to the map. Add a flag to do so: false by default because iterated rectangles are not always in map coordinates.
Diffstat (limited to 'crawl-ref/source/areas.cc')
-rw-r--r--crawl-ref/source/areas.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc
index 5f954caf72..c8c4b65330 100644
--- a/crawl-ref/source/areas.cc
+++ b/crawl-ref/source/areas.cc
@@ -301,7 +301,7 @@ bool remove_sanctuary(bool did_attack)
const int radius = 5;
bool seen_change = false;
- for (rectangle_iterator ri(env.sanctuary_pos, radius); ri; ++ri)
+ for (rectangle_iterator ri(env.sanctuary_pos, radius, true); ri; ++ri)
if (is_sanctuary(*ri))
{
_remove_sanctuary_property(*ri);
@@ -348,7 +348,7 @@ void decrease_sanctuary_radius()
stop_running();
}
- for (rectangle_iterator ri(env.sanctuary_pos, size+1); ri; ++ri)
+ for (rectangle_iterator ri(env.sanctuary_pos, size+1, true); ri; ++ri)
{
int dist = distance2(*ri, env.sanctuary_pos);