summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-21 08:32:56 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-21 08:32:56 +0000
commit6bbe0d1b66e3cac4a17166346504287d9d279279 (patch)
treefcc7f8a5c1305d4bf3d7469b44ebd740d66f50a4
parent18a52cff9da593a0fe772d018404ca0730c1e229 (diff)
downloadcrawl-ref-6bbe0d1b66e3cac4a17166346504287d9d279279.tar.gz
crawl-ref-6bbe0d1b66e3cac4a17166346504287d9d279279.zip
Travel should not use rock stairs as the final step in reaching the destination level (doy).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2498 c06c8d41-db1a-0410-9941-cceddc491573
-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;
}