diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-30 15:53:09 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-30 15:53:09 +0000 |
commit | e2179589b89a1d9786aa3111286af81878d21219 (patch) | |
tree | dcde637281ec374d339bf6cbc5012176e9b3f269 /crawl-ref/source/stash.cc | |
parent | 19bba5a5ec358bc8821bc3118add964ff303f7a9 (diff) | |
download | crawl-ref-e2179589b89a1d9786aa3111286af81878d21219.tar.gz crawl-ref-e2179589b89a1d9786aa3111286af81878d21219.zip |
Introducing shortcut for searching the current level as
requested in FR 1801705.
Also adding feedback when auto-travel fails to kick in.
And trying to get out of a net no longer stops travel, only
being caught in one does (FR 1800821).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2263 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stash.cc')
-rw-r--r-- | crawl-ref/source/stash.cc | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 376fce0dd7..86dc1c27d4 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -7,6 +7,7 @@ */ #include "AppHdr.h" +#include "branch.h" #include "chardump.h" #include "cio.h" #include "clua.h" @@ -1369,15 +1370,14 @@ void StashTracker::search_stashes() char prompt[200]; if (lastsearch.length()) snprintf(prompt, sizeof prompt, - "Search for what [Enter for \"%s\"]?", - lastsearch.c_str()); + "Search for what [Enter for \"%s\"%s]?\n", + lastsearch.c_str(), lastsearch != "." ? + ", or press . for all items on level" : ""); else snprintf(prompt, sizeof prompt, - "Search for what?"); + "Search for what [Press . for all items on level]?\n"); mpr(prompt, MSGCH_PROMPT); - // Push the cursor down to the next line. - mpr("", MSGCH_PROMPT); char buf[400]; bool validline = @@ -1387,6 +1387,30 @@ void StashTracker::search_stashes() return; std::string csearch = *buf? buf : lastsearch; + std::string help = lastsearch; + lastsearch = csearch; + + if (csearch == ".") + { + if (you.level_type == LEVEL_DUNGEON) + { + snprintf(info, INFO_SIZE, "%s:%d", + branches[you.where_are_you].abbrevname, player_branch_depth()); + csearch = info; + } + else if (you.level_type == LEVEL_PORTAL_VAULT) + csearch = "{Port}"; + else if (you.level_type == LEVEL_PANDEMONIUM) + csearch = "{Pan}"; + // items in Abyss and Labyrinths are not tracked + else if (you.level_type == LEVEL_ABYSS + || you.level_type == LEVEL_LABYRINTH) + { + mprf("Items in %s cannot be tracked.", + you.level_type == LEVEL_ABYSS ? "the Abyss" : "labyrinths"); + return; + } + } std::vector<stash_search_result> results; base_pattern *search = NULL; @@ -1402,11 +1426,10 @@ void StashTracker::search_stashes() if (!search->valid()) { mpr("Your search expression is invalid.", MSGCH_PLAIN); + lastsearch = help; return ; } - lastsearch = csearch; - get_matching_stashes(*search, results); if (results.empty()) |