From 93e7444ded284ca5da6ea59e1064af932bd067ca Mon Sep 17 00:00:00 2001 From: ennewalker Date: Wed, 24 Dec 2008 22:50:45 +0000 Subject: [2462140] Reverting previous check in to add more lines to the help menus. The better solution is to pick the text-only menu or the graphical menu in the constructor. This fixes an issue where there's a floating '=' x 80 line on the help screen sometimes, due to the graphical and textual draw_stock_item functions being inappropriately mixed. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7965 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/invent.cc | 3 +-- crawl-ref/source/menu.cc | 17 +++++++++-------- crawl-ref/source/menu.h | 6 ++---- 3 files changed, 12 insertions(+), 14 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 6610fb180c..d736e1d8d7 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -270,11 +270,10 @@ InvShowPrices::~InvShowPrices() } InvMenu::InvMenu(int mflags) - : Menu(mflags, "inventory"), type(MT_INVLIST), pre_select(NULL), + : Menu(mflags, "inventory", false), type(MT_INVLIST), pre_select(NULL), title_annotate(NULL) { mdisplay->set_num_columns(2); - text_only = false; } // Returns vector of item_def pointers to each item_def in the given diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 50faf2a82f..74507803e2 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -20,6 +20,7 @@ MenuDisplay::MenuDisplay(Menu *menu) : m_menu(menu) { + m_menu->set_maxpagesize(get_number_of_lines()); } MenuDisplayText::MenuDisplayText(Menu *menu) : MenuDisplay(menu), m_starty(1) @@ -79,15 +80,18 @@ void MenuDisplayTile::set_num_columns(int columns) } #endif -Menu::Menu( int _flags, const std::string& tagname ) +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), text_only(true), last_selected(-1) + lastch(0), alive(false), last_selected(-1) { #ifdef USE_TILE - mdisplay = new MenuDisplayTile(this); + if (text_only) + mdisplay = new MenuDisplayText(this); + else + mdisplay = new MenuDisplayTile(this); #else mdisplay = new MenuDisplayText(this); #endif @@ -107,7 +111,7 @@ Menu::Menu( const formatted_string &fs ) lastch(0), alive(false), last_selected(-1) { #ifdef USE_TILE - mdisplay = new MenuDisplayTile(this); + mdisplay = new MenuDisplayText(this); #else mdisplay = new MenuDisplayText(this); #endif @@ -272,10 +276,7 @@ std::vector Menu::show(bool reuse_selections) // Lose lines for the title + room for -more- line. #ifdef USE_TILE - if (text_only) - pagesize = get_number_of_lines() - !!title - 1; - else - pagesize = max_pagesize - !!title - 1; + pagesize = max_pagesize - !!title - 1; #else pagesize = get_number_of_lines() - !!title - 1; if (max_pagesize > 0 && pagesize > max_pagesize) diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h index 264e020057..407c41210e 100644 --- a/crawl-ref/source/menu.h +++ b/crawl-ref/source/menu.h @@ -237,7 +237,8 @@ public: class Menu { public: - Menu( int flags = MF_MULTISELECT, const std::string& tagname = "" ); + Menu(int flags = MF_MULTISELECT, const std::string& tagname = "", + bool text_only = true); // Initializes a Menu from a formatted_string as follows: // @@ -329,9 +330,6 @@ protected: bool alive; - // For tiles, whether this is a menu that can display graphics. - bool text_only; - int last_selected; MenuDisplay *mdisplay; -- cgit v1.2.3-54-g00ecf