summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-tornado.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2012-08-04 13:40:53 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2012-08-04 13:40:53 -0600
commit6f473416a0b6cffe0759a792ac536c739c4a395f (patch)
treeae918c7265efa218e64fbff41defff1874ca6d5a /crawl-ref/source/spl-tornado.cc
parent8467ec47beddc8af560fc5cce0b837194f8dc757 (diff)
downloadcrawl-ref-6f473416a0b6cffe0759a792ac536c739c4a395f.tar.gz
crawl-ref-6f473416a0b6cffe0759a792ac536c739c4a395f.zip
Prevent Tornado from moving monsters through solid features.
This adds a check to see if there's an unblocked line between where a monster affected by Tornado started and possible positions it could end up, throwing out any where such a line doesn't exist. Fixes #4296 and #5986.
Diffstat (limited to 'crawl-ref/source/spl-tornado.cc')
-rw-r--r--crawl-ref/source/spl-tornado.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/crawl-ref/source/spl-tornado.cc b/crawl-ref/source/spl-tornado.cc
index b3b8cae8d6..ebc6d44d32 100644
--- a/crawl-ref/source/spl-tornado.cc
+++ b/crawl-ref/source/spl-tornado.cc
@@ -162,7 +162,7 @@ static coord_def _rotate(coord_def org, coord_def from,
if (avail.empty())
return from;
- coord_def best;
+ coord_def best = from;
double hiscore = 1e38;
double dist0 = sqrt((from - org).abs());
@@ -171,6 +171,11 @@ static coord_def _rotate(coord_def org, coord_def from,
ang0 -= 2 * PI;
for (unsigned int i = 0; i < avail.size(); i++)
{
+ // If the path is blocked - say the monster is in a cage -
+ // veto the cell.
+ if (!cell_see_cell(from, avail[i], LOS_SOLID_SEE))
+ continue;
+
double dist = sqrt((avail[i] - org).abs());
double distdiff = fabs(dist - dist0);
double ang = atan2(avail[i].x - org.x, avail[i].y - org.y);