git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@728 c06c8d41-db1a-0410-9941-cceddc491573
ASCTVJSN3NXYQHRVXAORA43CV6H5V2572IMK4UGRHKBAGJOWHC4AC // Check the flags, food/scrolls/potions don't care about the item's// ident status (scrolls and potions are known by identifying any// one of them, the individual status might not be the same).if (item1.base_type == OBJ_FOOD|| item1.base_type == OBJ_SCROLLS|| item1.base_type == OBJ_POTIONS){if ((item1.flags & ~ISFLAG_IDENT_MASK)!= (item2.flags & ~ISFLAG_IDENT_MASK)){return (false);}
// Check the ID flagsif ( (item1.flags & full_ident_mask(item1)) !=(item2.flags & full_ident_mask(item2)) )return false;
// Thanks to mummy cursing, we can have potions of decay// that don't look alike... so we don't stack potions// if either isn't identified and they look different. -- bwrif (item1.base_type == OBJ_POTIONS&& item1.special != item2.special&& (!item_ident( item1, ISFLAG_KNOW_TYPE )|| !item_ident( item2, ISFLAG_KNOW_TYPE ))){return (false);}}else if (item1.flags != item2.flags){return (false);}
// Check the non-ID flagsif ((item1.flags & (~ISFLAG_IDENT_MASK)) !=(item2.flags & (~ISFLAG_IDENT_MASK)))return false;
// Thanks to mummy cursing, we can have potions of decay// that don't look alike... so we don't stack potions// if either isn't identified and they look different. -- bwrif (item1.base_type == OBJ_POTIONS && item1.special != item2.special &&(!item_ident(item1, ISFLAG_KNOW_TYPE) ||!item_ident(item2, ISFLAG_KNOW_TYPE )))return false;
bool fully_identified( const item_def& item ) {long flagset = ISFLAG_IDENT_MASK;switch ( item.base_type ) {
// 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;
// XXX This is a bit too generous, as it lets the player determine// that the bolt of fire he just shot from a flaming bow is actually// a poison arrow. Hopefully this isn't too abusable.static bool determines_ammo_brand(int bow_brand, int ammo_brand){if (bow_brand == SPWPN_FLAME && ammo_brand == SPMSL_FLAME)return false;if (bow_brand == SPWPN_FROST && ammo_brand == SPMSL_ICE)return false;if (bow_brand == SPWPN_VENOM && ammo_brand == SPMSL_POISONED)return false;return true;}
// ammo known if we can't attribute it to the bowif (bow_brand != SPWPN_FROST){set_ident_flags( item, ISFLAG_KNOW_TYPE );set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_TYPE );}}// ammo known if it cancels the effect of the bowif ((bow_brand == SPWPN_FLAME && ammo_brand == SPMSL_ICE)|| (bow_brand == SPWPN_FROST && ammo_brand == SPMSL_FLAME)){set_ident_flags( item, ISFLAG_KNOW_TYPE );set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_TYPE );