summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc47
1 files changed, 46 insertions, 1 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index b2e12e140b..78ce892ea1 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -85,6 +85,9 @@ static level_id last_stair;
// Where travel wants to get to.
static travel_target level_target;
+// Remember the last place explore stopped because autopickup failed.
+static coord_def explore_stopped_pos;
+
// The place in the Vestibule of Hell where all portals to Hell land.
static level_pos travel_hell_entry;
@@ -512,10 +515,12 @@ void travel_init_new_level()
// Zero out last travel coords
you.travel_x = you.travel_y = 0;
- traps_inited = false;
+ traps_inited = false;
curr_excludes.clear();
travel_cache.set_level_excludes();
travel_cache.update_waypoints();
+
+ explore_stopped_pos.reset();
}
/*
@@ -896,6 +901,43 @@ static void explore_find_target_square()
}
}
+void explore_pickup_event(int did_pickup, int tried_pickup)
+{
+ if (!did_pickup && !tried_pickup)
+ return;
+
+ if (!you.running.is_explore())
+ return;
+
+ if (did_pickup)
+ {
+ const int estop =
+ you.running == RMODE_EXPLORE_GREEDY?
+ ES_GREEDY_PICKUP : ES_PICKUP;
+ if ((Options.explore_stop & estop) && prompt_stop_explore(estop))
+ stop_delay();
+ }
+
+ // Greedy explore has no good way to deal with an item that we can't
+ // pick up, so the only thing to do is to stop.
+ if (tried_pickup && you.running == RMODE_EXPLORE_GREEDY)
+ {
+ stop_delay();
+ if (explore_stopped_pos == you.pos()
+ && !Options.pickup_dropped)
+ {
+ const std::string prompt =
+ make_stringf(
+ "Could not pick up %s here, shall I ignore %s? ",
+ tried_pickup == 1? "an item" : "some items",
+ tried_pickup == 1? "it" : "them");
+ if (yesno(prompt.c_str(), true, 'y'))
+ mark_items_dropped_at(you.pos());
+ }
+ explore_stopped_pos = you.pos();
+ }
+}
+
/*
* Top-level travel control (called from input() in acr.cc).
*
@@ -1006,7 +1048,10 @@ command_type travel()
{
if ((Options.explore_stop & ES_ITEM)
&& prompt_stop_explore(ES_ITEM))
+ {
+ explore_stopped_pos = coord_def(new_x, new_y);
stop_running();
+ }
return direction_to_command( *move_x, *move_y );
}
}