summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/invent.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-14 18:30:25 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-14 18:30:25 +0000
commit8c58a5f6f1d5e3c7482153b5d188794108390ecb (patch)
tree20cb82177736a96ae2edb4af7e923b4d72f97722 /crawl-ref/source/invent.cc
parent998211ec147b43ad5a3879d060dba48c876c3efc (diff)
downloadcrawl-ref-8c58a5f6f1d5e3c7482153b5d188794108390ecb.tar.gz
crawl-ref-8c58a5f6f1d5e3c7482153b5d188794108390ecb.zip
Overlay tiles in menu with tiles for being equipped/cursed/melded, the
flavoured floor, and weapon brands. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9477 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r--crawl-ref/source/invent.cc46
1 files changed, 43 insertions, 3 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 81bf34f5ed..616b348e5f 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -463,8 +463,42 @@ bool InvEntry::get_tiles(std::vector<tile_def>& tileset) const
if (!idx)
return (false);
- tileset.push_back(tile_def(TILE_ITEM_SLOT, TEX_DUNGEON));
- tileset.push_back(tile_def(idx, TEX_DEFAULT));
+ if (in_inventory(*item))
+ {
+ const bool equipped = item_is_equipped(*item);
+ if (equipped)
+ {
+ if (item_cursed(*item))
+ tileset.push_back(tile_def(TILE_ITEM_SLOT_EQUIP_CURSED, TEX_DEFAULT));
+ else
+ tileset.push_back(tile_def(TILE_ITEM_SLOT_EQUIP, TEX_DEFAULT));
+ }
+ else if (item_cursed(*item))
+ tileset.push_back(tile_def(TILE_ITEM_SLOT_CURSED, TEX_DEFAULT));
+
+ tileset.push_back(tile_def(TILE_ITEM_SLOT, TEX_DUNGEON));
+ tileset.push_back(tile_def(idx, TEX_DEFAULT));
+
+ // Is item melded?
+ if (equipped && !you_tran_can_wear(*item))
+ tileset.push_back(tile_def(TILE_MESH, TEX_DEFAULT));
+ }
+ else
+ {
+ // Do we want to display the floor type or is that too distracting?
+ const coord_def c = item->pos;
+ int ch = tileidx_feature(grd(c), c.x, c.y);
+ if (ch == TILE_FLOOR_NORMAL)
+ ch = env.tile_flv(c).floor;
+ else if (ch == TILE_WALL_NORMAL)
+ ch = env.tile_flv(c).wall;
+
+ tileset.push_back(tile_def(ch, TEX_DUNGEON));
+ tileset.push_back(tile_def(idx, TEX_DEFAULT));
+ }
+ int brand = tile_known_weapon_brand(*item);
+ if (brand)
+ tileset.push_back(tile_def(brand, TEX_DEFAULT));
return (true);
}
@@ -868,8 +902,11 @@ std::vector<SelItem> select_items( const std::vector<const item_def*> &items,
static bool _item_class_selected(const item_def &i, int selector)
{
const int itype = i.base_type;
- if (selector == OSEL_ANY || selector == itype && itype != OBJ_ARMOUR)
+ if (selector == OSEL_ANY || selector == itype
+ && itype != OBJ_FOOD && itype != OBJ_ARMOUR)
+ {
return (true);
+ }
switch (selector)
{
@@ -915,6 +952,9 @@ static bool _item_class_selected(const item_def &i, int selector)
case OSEL_ENCH_ARM:
return (is_enchantable_armour(i, true, true));
+ case OBJ_FOOD:
+ return (itype == OBJ_FOOD && !is_inedible(i));
+
case OSEL_VAMP_EAT:
return (itype == OBJ_CORPSES && i.sub_type == CORPSE_BODY
&& !food_is_rotten(i) && mons_has_blood(i.plus));