summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-29 12:38:49 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-29 12:38:49 +0000
commit883d0ce492391cc7cfeed1836b4a4e5fc5f4b24e (patch)
tree89a877ee214edcab9867b8850cb381432ae2d600 /crawl-ref/source/items.cc
parentb69356ae0558ebc5431444fce3c9b0636e2812b5 (diff)
downloadcrawl-ref-883d0ce492391cc7cfeed1836b4a4e5fc5f4b24e.tar.gz
crawl-ref-883d0ce492391cc7cfeed1836b4a4e5fc5f4b24e.zip
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
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc44
1 files changed, 17 insertions, 27 deletions
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);
}