diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-11 20:01:06 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-11 20:01:06 +0000 |
commit | 4c540e1c4e99150305b9c5297928ed1794cec13c (patch) | |
tree | 3ce5ba4f11d96ba590256bdd446ae8204091a0a7 /crawl-ref/source/stash.cc | |
parent | f792f9b19c0dcdbe4166ad0dc543f704822bfa29 (diff) | |
download | crawl-ref-4c540e1c4e99150305b9c5297928ed1794cec13c.tar.gz crawl-ref-4c540e1c4e99150305b9c5297928ed1794cec13c.zip |
Generalize the menu toggle from InvMenu to Menu and use it to properly
tie ability descriptions into the menu.
Still haven't worked out how to update the titles, though. :(
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9412 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stash.cc')
-rw-r--r-- | crawl-ref/source/stash.cc | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index a6b03ceb81..ad98884048 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -1778,14 +1778,13 @@ public: StashSearchMenu(const char* sort_style_) : Menu(), can_travel(true), request_toggle_sort_method(false), - menu_action(ACT_TRAVEL), +// allow_toggle(true), menu_action(ACT_EXECUTE), sort_style(sort_style_) { } public: bool can_travel; bool request_toggle_sort_method; - enum action { ACT_TRAVEL, ACT_EXAMINE, ACT_NUM } menu_action; const char* sort_style; protected: @@ -1806,8 +1805,8 @@ void StashSearchMenu::draw_title() char buf[200]; snprintf(buf, 200, - "<lightgrey> [<w>a-z</w>: %s <w>?</w>: change action <w>/</w>: change sort]", - menu_action == ACT_TRAVEL ? "travel" : "examine"); + "<lightgrey> [<w>a-z</w>: %s <w>?</w>/<w>!</w>: change action <w>/</w>: change sort]", + menu_action == ACT_EXECUTE ? "travel" : "examine"); draw_title_suffix(formatted_string::parse_string(buf), false); } @@ -1816,14 +1815,7 @@ void StashSearchMenu::draw_title() bool StashSearchMenu::process_key(int key) { - if (key == '?') - { - sel.clear(); - menu_action = (action)((menu_action+1) % ACT_NUM); - update_title(); - return (true); - } - else if (key == '/') + if (key == '/') { request_toggle_sort_method = true; return (false); @@ -1845,6 +1837,8 @@ bool StashTracker::display_search_results( StashSearchMenu stashmenu(sort_style); stashmenu.set_tag("stash"); stashmenu.can_travel = travelable; + stashmenu.allow_toggle = true; + stashmenu.menu_action = Menu::ACT_EXECUTE; std::string title = "match"; MenuEntry *mtitle = new MenuEntry(title, MEL_TITLE); @@ -1920,7 +1914,7 @@ bool StashTracker::display_search_results( } redraw_screen(); - if (sel.size() == 1 && stashmenu.menu_action == StashSearchMenu::ACT_TRAVEL) + if (sel.size() == 1 && stashmenu.menu_action == Menu::ACT_EXECUTE) { const stash_search_result *res = static_cast<stash_search_result *>(sel[0]->data); |