diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-19 19:01:25 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-19 19:01:25 +0000 |
commit | 5f61c3caf7af3eee7467d860d4b284bbcd7b6f70 (patch) | |
tree | d33179e3fb1621d71e748bbccc7fa37f505eec21 /crawl-ref/source/travel.cc | |
parent | 0ee4e39dafef899a70bb27ad6604cc3e642f3753 (diff) | |
download | crawl-ref-5f61c3caf7af3eee7467d860d4b284bbcd7b6f70.tar.gz crawl-ref-5f61c3caf7af3eee7467d860d4b284bbcd7b6f70.zip |
Fix 1858979: Monsters being capable to reach through wallsl.
(And some cleanup.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5136 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r-- | crawl-ref/source/travel.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 5e6a845136..6c97a115b7 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -945,8 +945,10 @@ static void explore_find_target_square() anti_zigzag_dir = 0; } else + { anti_zigzag_dir = std::min(prev_travel_moves[0], prev_travel_moves[1]) + 1; + } } // anti_zigzag_dir might have just been set, or might have @@ -1133,7 +1135,7 @@ command_type travel() // Speed up explore by not doing a double-floodfill if we have // a valid target. if (!you.running.x - || (you.running.x == you.x_pos && you.running.y == you.y_pos) + || you.running.x == you.x_pos && you.running.y == you.y_pos || !is_valid_explore_target(you.running.x, you.running.y)) { explore_find_target_square(); @@ -1488,13 +1490,14 @@ coord_def travel_pathfind::pathfind(run_mode_type rmode) unexplored_place = greedy_place = coord_def(0, 0); unexplored_dist = greedy_dist = UNFOUND_DIST; - refdist = Options.explore_item_greed > 0? &unexplored_dist: &greedy_dist; + refdist = (Options.explore_item_greed > 0) ? &unexplored_dist + : &greedy_dist; // Abort run if we're trying to go someplace evil. Travel to traps is // specifically allowed here if the player insists on it. if (!floodout && !is_travelsafe_square(start.x, start.y, false) - && !is_trap(start.x, start.y)) // The player likes pain + && !is_trap(start.x, start.y)) // player likes pain { return coord_def(0, 0); } @@ -1532,8 +1535,8 @@ coord_def travel_pathfind::pathfind(run_mode_type rmode) { if (path_examine_point(circumference[circ_index][i])) { - return (runmode == RMODE_TRAVEL? travel_move() - : explore_target()); + return (runmode == RMODE_TRAVEL ? travel_move() + : explore_target()); } } @@ -1573,14 +1576,16 @@ coord_def travel_pathfind::pathfind(run_mode_type rmode) // 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); } } - return (rmode == RMODE_TRAVEL? travel_move() - : explore_target()); + return (rmode == RMODE_TRAVEL ? travel_move() + : explore_target()); } bool travel_pathfind::square_slows_movement(const coord_def &c) |