From 883d0ce492391cc7cfeed1836b4a4e5fc5f4b24e Mon Sep 17 00:00:00 2001 From: haranp Date: Fri, 29 Dec 2006 12:38:49 +0000 Subject: Hopefully, finally squashed the stacking bug. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@728 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/items.cc | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) (limited to 'crawl-ref/source/items.cc') diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 0840427637..9a5afc4fcf 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1327,34 +1327,24 @@ bool items_stack( const item_def &item1, const item_def &item2 ) } } - // 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 flags + if ( (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. -- bwr - if (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 flags + if ((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. -- bwr + if (item1.base_type == OBJ_POTIONS && item1.special != item2.special && + (!item_ident(item1, ISFLAG_KNOW_TYPE) || + !item_ident(item2, ISFLAG_KNOW_TYPE ))) + return false; return (true); } -- cgit v1.2.3-54-g00ecf