summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-04 07:10:27 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-04 07:10:27 +0000
commit8fe0fae874a09acfbd56f3d2d6e68627a2eea732 (patch)
tree273a277f939b9b2ddbd72529afc6976fa17ea9ac /crawl-ref/source/travel.cc
parent61aa415257407644740dc5e91d30bd94cdbd5327 (diff)
downloadcrawl-ref-8fe0fae874a09acfbd56f3d2d6e68627a2eea732.tar.gz
crawl-ref-8fe0fae874a09acfbd56f3d2d6e68627a2eea732.zip
Minor greedy-explore tweaks:
* It now stops when reaching a pile of stuff so that the player can examine the stuff even if autopickup does not kick in. * Fixed the bug where it would remember its old explore target even if the player subsequently moved halfway across the level from it. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@548 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc28
1 files changed, 26 insertions, 2 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 6e16d71834..f48c910371 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -915,6 +915,29 @@ command_type travel()
// we turn off travel (find_travel_pos does that automatically).
find_travel_pos(you.x_pos, you.y_pos, move_x, move_y);
+ if ((*move_x || *move_y) && you.running == RMODE_EXPLORE_GREEDY)
+ {
+ // Greedy explore should cut off on reaching an item. We can't
+ // check after reaching the item, because at that point the stash
+ // tracker will have verified the stash and say "false" to
+ // needs_visit.
+ const int new_x = you.x_pos + *move_x;
+ const int new_y = you.y_pos + *move_y;
+
+ if (new_x == you.running.x && new_y == you.running.y)
+ {
+ const LevelStashes *lev = stashes.find_current_level();
+ if (lev && lev->needs_visit(new_x, new_y)
+ && !lev->shop_needs_visit(new_x, new_y))
+ {
+ if ((Options.explore_stop & ES_ITEM)
+ && prompt_stop_explore(ES_ITEM))
+ stop_running();
+ return direction_to_command( *move_x, *move_y );
+ }
+ }
+ }
+
if (!*move_x && !*move_y)
{
// If we've reached the square we were traveling towards, travel
@@ -985,10 +1008,10 @@ command_type travel()
redraw_screen();
if (!you.running)
- return CMD_NO_CMD;
+ return CMD_NO_CMD;
if ( result != CMD_NO_CMD )
- return result;
+ return result;
return direction_to_command( *move_x, *move_y );
}
@@ -2327,6 +2350,7 @@ void start_explore(bool grab_items)
// Clone shadow array off map
copy(env.map, mapshadow);
+ you.running.x = you.running.y = 0;
start_running();
}