summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-25 19:16:13 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-25 19:16:13 +0000
commitecb9b51784088ab22126740c4080557612d63db0 (patch)
tree816814118bf1930bc3e0b83a25b2c415b352923d /crawl-ref
parentb1c2d6e096eebdbae0c2f5a8dd48a5f67a1eb678 (diff)
downloadcrawl-ref-ecb9b51784088ab22126740c4080557612d63db0.tar.gz
crawl-ref-ecb9b51784088ab22126740c4080557612d63db0.zip
[2182289] Fixing travel problems when trying to travel to a non-traversable square. (It would try to route to other levels, which was wrong.) I'm far from an expert on the travel code, so if this breaks something that my small set of manual tests didn't turn up, please let me know.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7976 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/travel.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 7148b04f38..43b5e6d916 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -2639,13 +2639,18 @@ static int _find_transtravel_stair( const level_id &cur,
// Okay, we don't seem to have a distance available to us, which
// means we're either (a) not standing on stairs or (b) whoever
// initiated interlevel travel didn't call
- // _populate_stair_distances. Assuming we're not on stairs, that
+ // _populate_stair_distances or (c) we're trying to travel to
+ // a non-traversable square. Assuming we're not on stairs, that
// situation can arise only if interlevel travel has been triggered
// for a location on the same level. If that's the case, we can get
// the distance off the travel_point_distance matrix.
+
deltadist = travel_point_distance[target.pos.x][target.pos.y];
+
+ // If deltadist is zero, travel is trying to occur to a non-seeded
+ // square, so bail. This can happen if trying to travel to a wall.
if (!deltadist && stair != target.pos)
- deltadist = -1;
+ return (-1);
}
if (deltadist != -1)