summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/output.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-18 17:06:11 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-18 17:06:11 +0000
commit8e2692d7dcf7a55e083413e2eca110b7d5919976 (patch)
treefdd7de3f882f336f7df0f8df134e384ae84d6c93 /crawl-ref/source/output.cc
parenta59025b069d3d08cfa7c5ccd21d3b0ae116da71c (diff)
downloadcrawl-ref-8e2692d7dcf7a55e083413e2eca110b7d5919976.tar.gz
crawl-ref-8e2692d7dcf7a55e083413e2eca110b7d5919976.zip
Finally implemented by applying Paul Du Bois' latest patch. :)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3442 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/output.cc')
-rw-r--r--crawl-ref/source/output.cc38
1 files changed, 30 insertions, 8 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 585ca6d078..e03f15cbfb 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1121,7 +1121,7 @@ void print_overview_screen()
bool calc_unid = false;
formatted_scroller cmd_help;
// Set flags, and don't use easy exit.
- cmd_help.set_flags(MF_NOSELECT | MF_ALWAYS_SHOW_MORE | MF_NOWRAP, false);
+ cmd_help.set_flags(MF_SINGLESELECT | MF_ALWAYS_SHOW_MORE | MF_NOWRAP, false);
cmd_help.set_more( formatted_string::parse_string(
"<cyan>[ + : Page down. - : Page up. Esc exits.]"));
cmd_help.set_tag("resists");
@@ -1363,6 +1363,7 @@ void print_overview_screen()
determine_color_string(rcfli), itosym1(rcfli));
cols.add_formatted(1, buf, false);
+ std::vector<char> equip_chars;
{
const int e_order[] =
{
@@ -1377,11 +1378,14 @@ void print_overview_screen()
if ( you.equip[ e_order[i] ] != -1)
{
- const item_def& item = you.inv[you.equip[e_order[i]]];
+ const int item_idx = you.equip[e_order[i]];
+ const item_def& item = you.inv[item_idx];
const char* colname = colour_to_str(item.colour);
- snprintf(buf, sizeof buf, "%-7s: <%s>%s</%s>",
- slot, colname,
- item.name(DESC_PLAIN).substr(0,37).c_str(), colname);
+ const char equip_char = index_to_letter(item_idx);
+ snprintf(buf, sizeof buf, "%-7s: <w>%c</w> - <%s>%s</%s>",
+ slot, equip_char, colname,
+ item.name(DESC_PLAIN).substr(0,33).c_str(), colname);
+ equip_chars.push_back(equip_char);
}
else
{
@@ -1429,12 +1433,30 @@ void print_overview_screen()
blines = cols.formatted_lines();
for (i = 0; i < blines.size(); ++i )
- cmd_help.add_item_formatted_string(blines[i]);
+ {
+ // Kind of a hack -- we don't care really what items these
+ // hotkeys go to. So just pick the first few.
+ const char hotkey = (i < equip_chars.size()) ? equip_chars[i] : 0;
+ cmd_help.add_item_formatted_string(blines[i], hotkey);
+ }
cmd_help.add_text(" ");
cmd_help.add_text(status_mut_abilities());
- cmd_help.show();
- redraw_screen();
+
+ while (true)
+ {
+ std::vector<MenuEntry *> results = cmd_help.show();
+ if (results.size() == 0)
+ {
+ redraw_screen();
+ break;
+ }
+
+ const char c = results[0]->hotkeys[0];
+ item_def& item = you.inv[letter_to_index(c)];
+ describe_item(item, false);
+ // loop around for another go.
+ }
}
// creates rows of short descriptions for current