summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-06 19:02:28 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-06 19:02:28 +0000
commit330032c4329842cdbfd5e0cde77a242f3fb11016 (patch)
tree081eed2f93e365a987b89209da64c20dbd8c0ff6
parenta4e8c54ac5ddc996f16ff6f33ba1b486ada4f490 (diff)
downloadcrawl-ref-330032c4329842cdbfd5e0cde77a242f3fb11016.tar.gz
crawl-ref-330032c4329842cdbfd5e0cde77a242f3fb11016.zip
* Fix menus missing entries with Options.tile_menu_icons = false.
* Add new sort order option charged to list empty wands last. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@9904 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/changes.stone_soup7
-rw-r--r--crawl-ref/docs/options_guide.txt5
-rw-r--r--crawl-ref/settings/init.txt2
-rw-r--r--crawl-ref/source/invent.cc20
-rw-r--r--crawl-ref/source/invent.h2
-rw-r--r--crawl-ref/source/it_use3.cc2
-rw-r--r--crawl-ref/source/menu.cc24
-rw-r--r--crawl-ref/source/tilereg.cc19
8 files changed, 52 insertions, 29 deletions
diff --git a/crawl-ref/docs/changes.stone_soup b/crawl-ref/docs/changes.stone_soup
index 678acc8e14..cf4fd73257 100644
--- a/crawl-ref/docs/changes.stone_soup
+++ b/crawl-ref/docs/changes.stone_soup
@@ -1,5 +1,5 @@
-Stone Soup 0.5.0 (2009????)
--------------------------
+Stone Soup 0.5.0 (200906??)
+---------------------------
Disclaimer: These are merely the highlights, not an exhaustive list of changes.
@@ -57,8 +57,9 @@ Monsters
--------
* Disallow zombified monsters' use of stairs.
* New monsters: trapdoor spider, rock worm, flaming corpse, chaos spawn.
-* Several cool new uniques.
* Monster descriptions list resistances and some other attributes.
+* Several cool new uniques.
+* Many of the later uniques appear a few dungeon levels earlier.
* Polymorphed uniques retain their spells and speech.
* Reintroduce chance of orc wizards and priests in early orc bands.
* Most monsters of the same genus will attempt to surround the player.
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index 03ce3406b5..d09b780aa5 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -1152,6 +1152,11 @@ sort_menus = [menu:](true | false | auto:X)[:sort_order]
basename and qualname, then non-chunk food items will be
sorted between the non-rotting and rotting chunks.
+ * charged:
+ Makes wands known or assumed to have some charges left appear
+ before wands known to be empty; irrelevant for all other item
+ types.
+
You can ask for a descending order sort by prefixing one or more
sort criteria with > as:
sort_menus = true : basename, >qty
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index aece9eed8a..30863b3f39 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -233,7 +233,7 @@ stash_filter = ring of hunger, amulet of inaccuracy
# easy_exit_menu = false
# msg_condense_repeats = false
# sort_menus = pickup: true : art, ego, basename, qualname, curse, qty
-sort_menus = inv: true : equipped, freshness
+sort_menus = inv: true : equipped, freshness, charged
##### 4-j Messages and Display Enhancements #####
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index be0bbc721d..fa1bce224d 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -326,7 +326,8 @@ InvMenu::InvMenu(int mflags)
: Menu(mflags, "inventory", false), type(MT_INVLIST), pre_select(NULL),
title_annotate(NULL)
{
- mdisplay->set_num_columns(2);
+ if (Options.tile_menu_icons)
+ mdisplay->set_num_columns(2);
}
// Returns vector of item_def pointers to each item_def in the given
@@ -647,8 +648,14 @@ bool sort_item_identified(const InvEntry *a)
return !item_type_known(*(a->item));
}
+bool sort_item_charged(const InvEntry *a)
+{
+ return (a->item->base_type != OBJ_WANDS
+ || !item_is_evokable(*(a->item), true));
+}
+
static bool _compare_invmenu_items(const InvEntry *a, const InvEntry *b,
- const item_sort_comparators *cmps)
+ const item_sort_comparators *cmps)
{
for (item_sort_comparators::const_iterator i = cmps->begin();
i != cmps->end(); ++i)
@@ -695,6 +702,7 @@ void init_item_sort_comparators(item_sort_comparators &list,
{ "art", compare_item<bool, sort_item_art> },
{ "equipped", compare_item<bool, sort_item_equipped> },
{ "identified",compare_item<bool, sort_item_identified> },
+ { "charged", compare_item<bool, sort_item_charged>},
{ "qty", compare_item<int, sort_item_qty> },
{ "slot", compare_item<int, sort_item_slot> },
{ "freshness", compare_item<int, sort_item_freshness> }
@@ -1029,7 +1037,7 @@ static bool _item_class_selected(const item_def &i, int selector)
return (item_is_rechargeable(i, true));
case OSEL_EVOKABLE:
- return (item_is_evokable(i, true));
+ return (item_is_evokable(i, true, true));
case OSEL_ENCH_ARM:
return (is_enchantable_armour(i, true, true));
@@ -1715,13 +1723,17 @@ bool prompt_failed(int retval, std::string msg)
return (true);
}
-bool item_is_evokable(const item_def &item, bool known, bool msg)
+bool item_is_evokable(const item_def &item, bool known, bool all_wands,
+ bool msg)
{
const bool wielded = (you.equip[EQ_WEAPON] == item.link);
switch (item.base_type)
{
case OBJ_WANDS:
+ if (all_wands)
+ return (true);
+
if (item.plus2 == ZAPCOUNT_EMPTY)
{
if (msg)
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index ac58610c62..ebac3475da 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -236,6 +236,6 @@ void init_item_sort_comparators(item_sort_comparators &list,
bool prompt_failed(int retval, std::string msg = "");
bool item_is_evokable(const item_def &item, bool known = false,
- bool msg = false);
+ bool all_wands = false, bool msg = false);
#endif
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 8d77442321..693e23ea59 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -814,7 +814,7 @@ bool evoke_item(int slot)
item_def& item = you.inv[slot];
// Also handles messages.
- if (!item_is_evokable(item, false, true))
+ if (!item_is_evokable(item, false, false, true))
return (false);
// Check inscriptions.
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index e4c5a6dc6a..e2a907f5f0 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -1347,7 +1347,7 @@ void slider_menu::new_selection(int nsel)
{
if (nsel < 0)
{
- if ( !is_set(MF_NOWRAP) )
+ if (!is_set(MF_NOWRAP))
{
do
{
@@ -1360,7 +1360,7 @@ void slider_menu::new_selection(int nsel)
}
if (nsel >= static_cast<int>(items.size()))
{
- if ( !is_set(MF_NOWRAP) )
+ if (!is_set(MF_NOWRAP))
{
do
{
@@ -1620,12 +1620,12 @@ int linebreak_string( std::string& s, int wrapcol, int maxcol )
size_t loc = 0;
int xpos = 0;
int breakcount = 0;
- while ( loc < s.size() )
+ while (loc < s.size())
{
- if ( s[loc] == '<' ) // tag
+ if (s[loc] == '<') // tag
{
// << escape
- if ( loc + 1 < s.size() && s[loc+1] == '<' )
+ if (loc + 1 < s.size() && s[loc+1] == '<')
{
++xpos;
loc += 2;
@@ -1633,24 +1633,24 @@ int linebreak_string( std::string& s, int wrapcol, int maxcol )
continue;
}
// skip tag
- while ( loc < s.size() && s[loc] != '>' )
+ while (loc < s.size() && s[loc] != '>')
++loc;
++loc;
}
else
{
// user-forced newline
- if ( s[loc] == '\n' )
+ if (s[loc] == '\n')
xpos = 0;
// soft linebreak
- else if ( s[loc] == ' ' && xpos > wrapcol )
+ else if (s[loc] == ' ' && xpos > wrapcol)
{
s.replace(loc, 1, "\n");
xpos = 0;
++breakcount;
}
// hard linebreak
- else if ( xpos > maxcol )
+ else if (xpos > maxcol)
{
s.insert(loc, "\n");
xpos = 0;
@@ -1691,7 +1691,7 @@ int linebreak_string2( std::string& s, int maxcol )
else
{
// user-forced newline, or one we just stuffed in
- if ( s[loc] == '\n' )
+ if (s[loc] == '\n')
{
xpos = 0;
spaceloc = 0;
@@ -1700,7 +1700,7 @@ int linebreak_string2( std::string& s, int maxcol )
}
// force a wrap?
- if ( xpos >= maxcol )
+ if (xpos >= maxcol)
{
if (spaceloc)
{
@@ -1717,7 +1717,7 @@ int linebreak_string2( std::string& s, int maxcol )
}
// save possible linebreak location
- if ( s[loc] == ' ' && xpos > 0)
+ if (s[loc] == ' ' && xpos > 0)
{
spaceloc = loc;
}
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 3bb15874ae..0188f20de0 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -2625,8 +2625,8 @@ void MenuRegion::place_entries()
const int heading_indent = 10;
const int tile_indent = 20;
const int text_indent = (Options.tile_menu_icons ? 58 : 20);
- const int max_tile_height = 32;
- const int entry_buffer = 1;
+ const int max_tile_height = (Options.tile_menu_icons ? 32 : 0);
+ const int entry_buffer = 1;
const VColour selected_colour(50, 50, 10, 255);
m_font_buf.clear();
@@ -2668,7 +2668,7 @@ void MenuRegion::place_entries()
column++;
}
- int text_width = m_font_entry->string_width(m_entries[i].text);
+ int text_width = m_font_entry->string_width(m_entries[i].text);
int text_height = m_font_entry->char_height();
if (m_entries[i].heading)
@@ -2714,7 +2714,8 @@ void MenuRegion::place_entries()
int text_sy = m_entries[i].sy;
text_sy += (entry_height - m_font_entry->char_height()) / 2;
- if (text_sx + text_width > entry_start + column_width)
+ if (Options.tile_menu_icons
+ && text_sx + text_width > entry_start + column_width)
{
// [enne] - Ugh, hack. Maybe MenuEntry could specify the
// presence and length of this substring?
@@ -2841,10 +2842,14 @@ int MenuRegion::maxpagesize() const
// It would be better to make menus use a dynamic number of items per page,
// but it'd require a lot more refactoring of menu.cc to handle that.
- int lines = count_linebreaks(m_more);
- int more_height = (lines + 1) * m_font_entry->char_height();
+ const int lines = count_linebreaks(m_more);
+ const int more_height = (lines + 1) * m_font_entry->char_height();
+
+ // Similar to the definition of max_entry_height in place_entries().
+ const int div = (Options.tile_menu_icons ? 32
+ : m_font_entry->char_height());
- int pagesize = ((my - more_height) / 32) * m_max_columns;
+ const int pagesize = ((my - more_height) / div) * m_max_columns;
// Upper limit for inventory menus. (jpeg)
// Non-inventory menus only have one column and need