summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/invent.cc
diff options
context:
space:
mode:
authorgammafunk <gammafunk@gmail.com>2014-05-26 05:21:20 -0500
committergammafunk <gammafunk@gmail.com>2014-05-26 22:45:16 -0500
commit55d1b512e3395f07e9341ce9eae5079b581b6894 (patch)
tree811704017046d8ed62335bd1c45d36476e0dea55 /crawl-ref/source/invent.cc
parentb364f15f4eeff0e148b6fc026c01de1327254cd2 (diff)
downloadcrawl-ref-55d1b512e3395f07e9341ce9eae5079b581b6894.tar.gz
crawl-ref-55d1b512e3395f07e9341ce9eae5079b581b6894.zip
Remove player burden and carrying capacity
Item inventory weights (based on item mass) generally don't lead to meaningful decisions that justify the inventory juggling and interface problems that come from having burden states. The 52-slot limit is a better system for limiting inventory and providing inventory-related decisions because it's not so fine-grained and doesn't require the player to examine weights for each slot. Work is ongoing to improve the slot system by consolidating food types and handling strategic consumables in a different way.
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r--crawl-ref/source/invent.cc54
1 files changed, 5 insertions, 49 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 934b4a1545..c395ea9ef4 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -66,8 +66,7 @@ string InvTitle::get_text(const bool) const
}
InvEntry::InvEntry(const item_def &i, bool show_bg)
- : MenuEntry("", MEL_ITEM), show_background(show_bg), item(&i),
- show_weight(false)
+ : MenuEntry("", MEL_ITEM), show_background(show_bg), item(&i)
{
data = const_cast<item_def *>(item);
@@ -219,16 +218,7 @@ string InvEntry::get_text(bool need_cursor) const
if (InvEntry::show_glyph)
tstr << "(" << glyph_to_tagstr(get_item_glyph(item)) << ")" << " ";
- //For weights display we need to know maximum number of chars in each column
- //which fit in one line.
- //XXX There should be a better way to determine this, for now we simply
- //estimate it by the following heuristics {kittel}.
unsigned max_chars_in_line = get_number_of_cols() - 2;
-#ifdef USE_TILE_LOCAL
- if (Options.tile_menu_icons && show_weight)
- max_chars_in_line = get_number_of_cols() * 4 / 9 - 2;
-#endif
-
int colour_tag_adjustment = 0;
if (InvEntry::show_glyph)
{
@@ -238,29 +228,13 @@ string InvEntry::get_text(bool need_cursor) const
colour_tag_adjustment = colour_tag.size() * 2 + 5;
}
- if (show_weight)
- max_chars_in_line -= 1;
-
- const int w_weight = show_weight ? 10 //length of " (999 aum)"
- : 0;
const int excess = strwidth(tstr.str()) - colour_tag_adjustment
- + strwidth(text) + w_weight - max_chars_in_line;
+ + strwidth(text) - max_chars_in_line;
if (excess > 0)
tstr << chop_string(text, max(0, strwidth(text) - excess - 2)) << "..";
else
tstr << text;
- if (show_weight)
- {
- const int mass = item_mass(*item) * item->quantity;
- // Note: If updating the " (%i aum)" format, remember to update
- // w_weight above.
- tstr << setw(max_chars_in_line - strwidth(tstr.str())
- + colour_tag_adjustment)
- << right
- << make_stringf(" (%i aum)",
- static_cast<int>(0.5 + BURDEN_TO_AUM * mass));
- }
return tstr.str();
}
@@ -411,13 +385,8 @@ void InvMenu::set_title(const string &s)
// so that get_number_of_cols returns the appropriate value.
cgotoxy(1, 1);
- const int cap = carrying_capacity(BS_UNENCUMBERED);
-
stitle = make_stringf(
- "Inventory: %.0f/%.0f aum (%d%%, %d/%d slots)",
- BURDEN_TO_AUM * you.burden,
- BURDEN_TO_AUM * cap,
- (you.burden * 100) / cap,
+ "Inventory: %d/%d slots",
inv_count(),
ENDOFPACK);
@@ -870,16 +839,12 @@ menu_letter InvMenu::load_items(const vector<const item_def*> &mitems,
items_in_class.clear();
InvEntry *forced_first = NULL;
- const bool show_weight = Options.show_inventory_weights
- >= (flags & MF_DROP_PICKUP ? MB_MAYBE : MB_TRUE);
for (int j = 0, count = mitems.size(); j < count; ++j)
{
if (mitems[j]->base_type != i)
continue;
InvEntry * const ie = new InvEntry(*mitems[j]);
- ie->show_weight = show_weight;
-
if (mitems[j]->sub_type == get_max_subtype(mitems[j]->base_type))
forced_first = ie;
else
@@ -941,15 +906,6 @@ vector<SelItem> InvMenu::get_selitems() const
bool InvMenu::process_key(int key)
{
- if (key == CONTROL('W'))
- {
- for (size_t i = 0; i < items.size(); i++)
- if (InvEntry *ie = dynamic_cast<InvEntry *>(items[i]))
- ie->show_weight = !ie->show_weight;
- draw_menu();
- return true;
- }
-
if (type == MT_KNOW)
{
bool resetting = (lastch == CONTROL('D'));
@@ -1113,14 +1069,14 @@ const char* item_slot_name(equipment_type type, bool terse)
vector<SelItem> select_items(const vector<const item_def*> &items,
const char *title, bool noselect,
- menu_type mtype, invtitle_annotator titlefn)
+ menu_type mtype,
+ invtitle_annotator titlefn)
{
vector<SelItem> selected;
if (!items.empty())
{
InvMenu menu;
menu.set_type(mtype);
- menu.set_title_annotator(titlefn);
menu.set_title(title);
if (mtype == MT_PICKUP)
{