summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-11 20:01:06 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-11 20:01:06 +0000
commit4c540e1c4e99150305b9c5297928ed1794cec13c (patch)
tree3ce5ba4f11d96ba590256bdd446ae8204091a0a7 /crawl-ref/source/menu.cc
parentf792f9b19c0dcdbe4166ad0dc543f704822bfa29 (diff)
downloadcrawl-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/menu.cc')
-rw-r--r--crawl-ref/source/menu.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 12f284f7eb..c891e715d3 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -84,11 +84,12 @@ void MenuDisplayTile::set_num_columns(int columns)
#endif
Menu::Menu( int _flags, const std::string& tagname, bool text_only )
- : f_selitem(NULL), f_drawitem(NULL), f_keyfilter(NULL), title(NULL),
- flags(_flags), tag(tagname), first_entry(0), y_offset(0),
- pagesize(0), max_pagesize(0), more("-more-", true), items(),
- sel(), select_filter(), highlighter(new MenuHighlighter), num(-1),
- lastch(0), alive(false), last_selected(-1)
+ : f_selitem(NULL), f_drawitem(NULL), f_keyfilter(NULL), allow_toggle(false),
+ menu_action(ACT_EXAMINE), title(NULL), flags(_flags), tag(tagname),
+ first_entry(0), y_offset(0), pagesize(0), max_pagesize(0),
+ more("-more-", true), items(), sel(), select_filter(),
+ highlighter(new MenuHighlighter), num(-1), lastch(0), alive(false),
+ last_selected(-1)
{
#ifdef USE_TILE
if (text_only)
@@ -329,6 +330,13 @@ bool Menu::process_key( int keyin )
lastch = keyin;
return (false);
}
+ else if (allow_toggle && (keyin == '!' || keyin == '?'))
+ {
+ sel.clear();
+ menu_action = (action)((menu_action+1) % ACT_NUM);
+ update_title();
+ return (true);
+ }
bool nav = false, repaint = false;
@@ -820,6 +828,7 @@ void Menu::draw_title()
void Menu::write_title()
{
textattr( item_colour(-1, title) );
+
cprintf("%s", title->get_text().c_str());
if (flags & MF_SHOW_PAGENUMBERS)
{
@@ -1678,8 +1687,8 @@ bool formatted_scroller::line_down()
bool formatted_scroller::line_up()
{
- if (first_entry > 0 && items[first_entry-1]->level != MEL_TITLE &&
- items[first_entry]->level != MEL_TITLE)
+ if (first_entry > 0 && items[first_entry-1]->level != MEL_TITLE
+ && items[first_entry]->level != MEL_TITLE)
{
--first_entry;
return (true);