summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-02 17:39:57 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-02 17:41:23 -0800
commit3f3c0139c0eeb94c90b2afad0ba6af493c0f2b08 (patch)
treeacd0560e74161ad6cfe0baae34f67f1f16dc79c4 /crawl-ref/source/travel.cc
parent26d303da422033aba61e9a8bd7e894ccc8ac5574 (diff)
downloadcrawl-ref-3f3c0139c0eeb94c90b2afad0ba6af493c0f2b08.tar.gz
crawl-ref-3f3c0139c0eeb94c90b2afad0ba6af493c0f2b08.zip
Implement map viewing for other levels
There are three new commands described on the X? screen. Interlevel travel works. Other levels are not currently highlighted by reachability; let me know if you want this. Interface stolen from TAEB :). dpeg's stair view is not yet in.
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 1dcfdaa0b1..a8bd3d5174 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -1367,6 +1367,46 @@ coord_def travel_pathfind::pathfind(run_mode_type rmode)
: explore_target());
}
+void travel_pathfind::get_features()
+{
+ ASSERT( features );
+
+ if (!ls && (annotate_map || need_for_greed))
+ ls = StashTrack.find_current_level();
+
+ memset(point_distance, 0, sizeof(travel_distance_grid_t));
+
+ for (int x = X_BOUND_1; x <= X_BOUND_2; ++x)
+ for (int y = Y_BOUND_1; y <= Y_BOUND_2; ++y)
+ {
+ coord_def dc(x,y);
+ dungeon_feature_type feature = grd(dc);
+
+ if ((feature != DNGN_FLOOR
+ && !feat_is_water(feature)
+ && feature != DNGN_LAVA)
+ || is_waypoint(dc)
+ || is_stash(ls, dc.x, dc.y)
+ || is_trap(dc))
+ {
+ features->push_back(dc);
+ }
+ }
+
+ for (int i = 0, size = curr_excludes.size(); i < size; ++i)
+ {
+ const travel_exclude &exc = curr_excludes[i];
+ // An exclude - wherever it is - is always a feature.
+ if (std::find(features->begin(), features->end(), exc.pos)
+ == features->end())
+ {
+ features->push_back(exc.pos);
+ }
+
+ _fill_exclude_radius(exc);
+ }
+}
+
bool travel_pathfind::square_slows_movement(const coord_def &c)
{
// c is a known (explored) location - we never put unknown points in the
@@ -1557,6 +1597,10 @@ bool travel_pathfind::point_traverse_delay(const coord_def &c)
// to be the target; otherwise, false.
bool travel_pathfind::path_examine_point(const coord_def &c)
{
+ // If we've run off the map, or are pathfinding from nowhere in particular
+ if (!in_bounds(c))
+ return (false);
+
if (point_traverse_delay(c))
return (false);