summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/invent.cc3
-rw-r--r--crawl-ref/source/menu.cc17
-rw-r--r--crawl-ref/source/menu.h6
3 files changed, 12 insertions, 14 deletions
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<MenuEntry *> 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;