From 7aad8aac57d72150fcdfc133f18462675467b729 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 9 Aug 2007 18:14:13 +0000 Subject: [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 --- crawl-ref/source/direct.cc | 5 ++++- crawl-ref/source/dungeon.cc | 34 ++++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index d8dcb66f74..3287e99d20 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1736,9 +1736,12 @@ static void describe_cell(int mx, int my) } const std::string traveldest = stair_destination_description(coord_def(mx, my)); - mprf("(%d,%d): %s - %s%s%s", mx, my, + const dungeon_feature_type feat = grd[mx][my]; + mprf("(%d,%d): %s - %s (%d/%s)%s%s", mx, my, stringize_glyph(get_screen_glyph(mx, my)).c_str(), feature_desc.c_str(), + feat, + dungeon_feature_name(feat), marker.c_str(), traveldest.c_str()); #else 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 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(mark)->feat - == DNGN_ENTER_LABYRINTH) + && dynamic_cast(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) -- cgit v1.2.3-54-g00ecf