diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-30 02:23:45 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-30 02:23:45 +0000 |
commit | b3a157e60e8c01aae3827e35e49306d775ea85d1 (patch) | |
tree | 670a371cb4de51ae9cb86ae987616977bb4c4baf | |
parent | 8e16f1a94ec8926ea4dc93f66e26c8512337e005 (diff) | |
download | crawl-ref-b3a157e60e8c01aae3827e35e49306d775ea85d1.tar.gz crawl-ref-b3a157e60e8c01aae3827e35e49306d775ea85d1.zip |
Mark quivered items as equipped (interface only, not gameplay.)
FR 2059687.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7071 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/itemname.cc | 22 | ||||
-rw-r--r-- | crawl-ref/source/items.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/items.h | 2 |
3 files changed, 20 insertions, 21 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index d8ab01f143..2d44e0a951 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -195,15 +195,11 @@ std::string item_def::name(description_level_type descrip, if (this->link == you.equip[EQ_WEAPON]) { - if (you.inv[ you.equip[EQ_WEAPON] ].base_type == OBJ_WEAPONS - || item_is_staff( you.inv[ you.equip[EQ_WEAPON] ] )) - { + if (this->base_type == OBJ_WEAPONS || item_is_staff(*this)) buff << " (weapon)"; - } else - { buff << " (in hand)"; - } + equipped = true; } else if (this->link == you.equip[EQ_CLOAK] @@ -231,12 +227,17 @@ std::string item_def::name(description_level_type descrip, buff << " (around neck)"; equipped = true; } + else if (this->link == you.m_quiver->get_fire_item(NULL)) + { + buff << " (quivered)"; + equipped = true; // well, sort of + } } if (descrip != DESC_BASENAME) { const bool tried = !ident && !equipped && item_type_tried(*this); - std::string tried_str = ""; + std::string tried_str; if (tried) { @@ -2627,12 +2628,17 @@ const std::string menu_colour_item_prefix(const item_def &item, bool temp) case OBJ_WEAPONS: case OBJ_ARMOUR: case OBJ_JEWELLERY: - if (item_is_equipped(item)) + if (item_is_equipped(item, true)) prefixes.push_back("equipped"); if (is_artefact(item)) prefixes.push_back("artefact"); break; + case OBJ_MISSILES: + if (item_is_equipped(item, true)) + prefixes.push_back("equipped"); + break; + default: break; } diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index c9756544f4..f20a518928 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2433,24 +2433,17 @@ item_def find_item_type(object_class_type base_type, std::string name) return (item); } -bool item_is_equipped(const item_def &item) +bool item_is_equipped(const item_def &item, bool quiver_too) { if (!in_inventory(item)) return (false); for (int i = 0; i < NUM_EQUIP; i++) - { - if (you.equip[i] == EQ_NONE) - continue; - - const item_def& eq(you.inv[you.equip[i]]); - - if (!is_valid_item(eq)) - continue; - - if (&eq == &item) + if (item.link == you.equip[i]) return (true); - } + + if (quiver_too && item.link == you.m_quiver->get_fire_item(NULL)) + return (true); return (false); } diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h index 25db8927f6..79ec57bf00 100644 --- a/crawl-ref/source/items.h +++ b/crawl-ref/source/items.h @@ -151,7 +151,7 @@ bool need_to_autoinscribe(); void request_autoinscribe(bool do_inscribe = true); void autoinscribe(); -bool item_is_equipped(const item_def &item); +bool item_is_equipped(const item_def &item, bool quiver_too = false); void item_was_lost(const item_def &item); void item_was_destroyed(const item_def &item, int cause = -1); |