summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-09 18:14:13 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-09 18:14:13 +0000
commit7aad8aac57d72150fcdfc133f18462675467b729 (patch)
tree01a59a64a0e80a8969c42847db61ae6d7a0b37f6 /crawl-ref/source/dungeon.cc
parent4e368c369ba334704aadad3c2f0800093ab7ebeb (diff)
downloadcrawl-ref-7aad8aac57d72150fcdfc133f18462675467b729.tar.gz
crawl-ref-7aad8aac57d72150fcdfc133f18462675467b729.zip
[1769972] Better handling of rogue markers.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1985 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc34
1 files changed, 24 insertions, 10 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 8c4aacb04b..9d56537d1d 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -6824,26 +6824,38 @@ static coord_def dgn_find_closest_to_stone_stairs()
return (np.nearest);
}
-static coord_def dgn_find_labyrinth_entry_point()
+static coord_def dgn_find_feature_marker(dungeon_feature_type feat)
{
std::vector<map_marker*> markers = env_get_all_markers();
for (int i = 0, size = markers.size(); i < size; ++i)
{
map_marker *mark = markers[i];
if (mark->get_type() == MAT_FEATURE
- && dynamic_cast<map_feature_marker*>(mark)->feat
- == DNGN_ENTER_LABYRINTH)
+ && dynamic_cast<map_feature_marker*>(mark)->feat == feat)
{
return (mark->pos);
}
}
coord_def unfound;
- return (unfound);
+ return (unfound);
+}
+
+static coord_def dgn_find_labyrinth_entry_point()
+{
+ return (dgn_find_feature_marker(DNGN_ENTER_LABYRINTH));
}
coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find,
bool find_closest)
{
+#ifdef DEBUG_DIAGNOSTICS
+ mprf(MSGCH_DIAGNOSTICS,
+ "Level entry point on %sstair: %d (%s)",
+ find_closest? "closest " : "",
+ stair_to_find,
+ dungeon_feature_name(stair_to_find));
+#endif
+
if (stair_to_find == DNGN_ROCK_STAIRS_UP
|| stair_to_find == DNGN_ROCK_STAIRS_DOWN)
{
@@ -6865,12 +6877,17 @@ coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find,
stair_to_find = DNGN_FLOOR;
}
+ if (stair_to_find == your_branch().exit_stairs)
+ {
+ const coord_def pos(dgn_find_feature_marker(DNGN_STONE_STAIRS_UP_I));
+ if (in_bounds(pos) && grd(pos) == stair_to_find)
+ return (pos);
+ }
+
// scan around the player's position first
int basex = you.x_pos;
int basey = you.y_pos;
- const bool branch_exit = stair_to_find == your_branch().exit_stairs;
-
// check for illegal starting point
if ( !in_bounds(basex, basey) )
{
@@ -6904,10 +6921,7 @@ coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find,
const int dist = (xpos-basex)*(xpos-basex) +
(ypos-basey)*(ypos-basey);
- if (grd[xpos][ypos] == stair_to_find
- && (!branch_exit
- || env_find_marker(coord_def(xpos, ypos),
- MAT_FEATURE)))
+ if (grd[xpos][ypos] == stair_to_find)
{
found++;
if (find_closest)