diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-27 12:40:18 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-27 12:40:18 +0000 |
commit | 79bbaa47cdd8caa7af8a9668be8d9287c9e34af7 (patch) | |
tree | 6e6665398ef4c990847476e91e9a706bde16c024 /crawl-ref/source/itemprop.cc | |
parent | ea7b6a69950ed580eebd008fdb6888024075266c (diff) | |
download | crawl-ref-79bbaa47cdd8caa7af8a9668be8d9287c9e34af7.tar.gz crawl-ref-79bbaa47cdd8caa7af8a9668be8d9287c9e34af7.zip |
More minor cleanups.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1378 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r-- | crawl-ref/source/itemprop.cc | 49 |
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: // |