summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-11 16:08:22 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-11 16:08:22 +0000
commit86a4b3a425d3afef3a2bd2304d08e87b6b49ff01 (patch)
treec57dcafc5349f9e06705f27cb9181e2389842773
parent6ac25ffd6efaa21bc9ac1d9a5828e7ae6412d292 (diff)
downloadcrawl-ref-86a4b3a425d3afef3a2bd2304d08e87b6b49ff01.tar.gz
crawl-ref-86a4b3a425d3afef3a2bd2304d08e87b6b49ff01.zip
Apply r6500 to 0.4.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6501 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/misc.cc14
-rw-r--r--crawl-ref/source/travel.cc15
-rw-r--r--crawl-ref/source/travel.h3
3 files changed, 25 insertions, 7 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 7e23bd12e7..4dd1b21753 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1623,6 +1623,8 @@ void up_stairs(dungeon_feature_type force_stair,
branches[you.where_are_you].longname);
}
+ int stair_x = you.x_pos, stair_y = you.y_pos;
+
#ifdef USE_TILE
const bool newlevel =
#endif
@@ -1677,8 +1679,6 @@ void up_stairs(dungeon_feature_type force_stair,
travel_cache.get_level_info(new_level_id);
new_level_info.update();
- int stair_x = you.x_pos, stair_y = you.y_pos;
-
// First we update the old level's stair.
level_pos lp;
lp.id = new_level_id;
@@ -1698,12 +1698,12 @@ void up_stairs(dungeon_feature_type force_stair,
if (new_level_id == BRANCH_MAIN_DUNGEON
&& old_level_id == BRANCH_VESTIBULE_OF_HELL)
{
- lp.id.depth = -1;
- lp.pos.x = lp.pos.y = -1;
- guess = true;
+ old_level_info.clear_stairs(DNGN_EXIT_HELL);
+ }
+ else
+ {
+ old_level_info.update_stair(stair_x, stair_y, lp, guess);
}
-
- old_level_info.update_stair(you.x_pos, you.y_pos, lp, guess);
// We *guess* that going up a staircase lands us on a downstair,
// and that we can descend that downstair and get back to where we
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index e8fbe6dc2b..680c66f191 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -3185,6 +3185,21 @@ void LevelInfo::sync_branch_stairs(const stair_info *si)
}
}
+void LevelInfo::clear_stairs(dungeon_feature_type grid)
+{
+ for (int i = 0, size = stairs.size(); i < size; ++i)
+ {
+ stair_info &si = stairs[i];
+ if (si.grid != grid)
+ continue;
+
+ si.destination.id.depth = -1;
+ si.destination.pos.x = -1;
+ si.destination.pos.y = -1;
+ si.guessed_pos = true;
+ }
+}
+
stair_info *LevelInfo::get_stair(int x, int y)
{
const coord_def c(x, y);
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 8f42f83cac..752c285044 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -486,6 +486,9 @@ struct LevelInfo
// Updates/creates a StairInfo for the stair at (x, y) in grid coordinates
void update_stair(int x, int y, const level_pos &p, bool guess = false);
+ // Clears all stair info for stairs matching this grid type.
+ void clear_stairs(dungeon_feature_type grid);
+
// Returns true if the given branch is known to be accessible from the
// current level.
bool is_known_branch(unsigned char branch) const;