summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemprop.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r--crawl-ref/source/itemprop.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 0b96e69de2..6204158da4 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -474,6 +474,55 @@ void unset_ident_flags( item_def &item, unsigned long flags )
item.flags &= (~flags);
}
+// Returns the mask of interesting identify bits for this item
+// (e.g., scrolls don't have know-cursedness.)
+unsigned long full_ident_mask( const item_def& item )
+{
+ unsigned long flagset = ISFLAG_IDENT_MASK;
+ switch ( item.base_type )
+ {
+ case OBJ_FOOD:
+ flagset = 0;
+ break;
+ case OBJ_BOOKS:
+ case OBJ_MISCELLANY:
+ case OBJ_ORBS:
+ case OBJ_SCROLLS:
+ case OBJ_POTIONS:
+ case OBJ_STAVES:
+ flagset = ISFLAG_KNOW_TYPE;
+ break;
+ case OBJ_WANDS:
+ flagset = (ISFLAG_KNOW_TYPE | ISFLAG_KNOW_PLUSES);
+ break;
+ case OBJ_JEWELLERY:
+ flagset = (ISFLAG_KNOW_CURSE | ISFLAG_KNOW_TYPE);
+ if ( ring_has_pluses(item) )
+ flagset |= ISFLAG_KNOW_PLUSES;
+ break;
+ case OBJ_MISSILES:
+ flagset = ISFLAG_KNOW_PLUSES | ISFLAG_KNOW_TYPE;
+ if (get_ammo_brand(item) == SPMSL_NORMAL)
+ flagset &= ~ISFLAG_KNOW_TYPE;
+ break;
+ case OBJ_WEAPONS:
+ case OBJ_ARMOUR:
+ default:
+ break;
+ }
+ if ( is_random_artefact(item) ||
+ is_fixed_artefact(item) )
+ {
+ flagset |= ISFLAG_KNOW_PROPERTIES;
+ }
+ return flagset;
+}
+
+bool fully_identified( const item_def& item )
+{
+ return item_ident(item, full_ident_mask(item));
+}
+
//
// Equipment race and description:
//