summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-21 08:36:44 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-21 08:36:44 +0000
commite1725ba032918d24238e0dbae5df26b533698b9b (patch)
tree83fd3d4345567e96735e984801dfdd67b7138747 /crawl-ref/source/travel.cc
parent94f2cdecb79dceb2b6cba5912f7fdc11db6a8c50 (diff)
downloadcrawl-ref-e1725ba032918d24238e0dbae5df26b533698b9b.tar.gz
crawl-ref-e1725ba032918d24238e0dbae5df26b533698b9b.zip
Rock stair travel fix for trunk.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2499 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index e9c0876d99..b2e12e140b 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -2460,6 +2460,17 @@ static int find_transtravel_stair( const level_id &cur,
const level_pos &dest = si.destination;
+ // Never use rock stairs as the last leg of the trip, since
+ // that will leave the player unable to retrace their path.
+ // This does not apply if we have a destination with a specific
+ // position on the target level travel wants to get to.
+ if (grid_is_rock_stair(si.grid)
+ && target.pos.x == -1
+ && dest.id == target.id)
+ {
+ continue;
+ }
+
// We can only short-circuit the stair-following process if we
// have no exact target location. If there *is* an exact target
// location, we can't follow stairs for which we have incomplete
@@ -2467,15 +2478,18 @@ static int find_transtravel_stair( const level_id &cur,
//
// We can also not use incomplete stair information if there are
// excludes on the target level.
- if (target.pos.x == -1 && dest.id == target.id
- && !target_has_excludes)
+ if (target.pos.x == -1
+ && dest.id == target.id
+ && !target_has_excludes)
{
if (local_distance == -1 || local_distance > dist2stair)
{
local_distance = dist2stair;
- if (cur == player_level && you.x_pos == stair.x &&
- you.y_pos == stair.y)
+ if (cur == player_level && you.x_pos == stair.x
+ && you.y_pos == stair.y)
+ {
best_stair = si.position;
+ }
}
continue;
}