summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-04 12:56:06 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-04 12:56:06 +0000
commita595b7fd82f3d7c054f4a28f6b2d5770e6aade15 (patch)
treed50a7f556066af8760486ccef7957b462a8c7013 /crawl-ref/source/items.cc
parent6289e90146bed25695d5e792302ada00caa9e734 (diff)
downloadcrawl-ref-a595b7fd82f3d7c054f4a28f6b2d5770e6aade15.tar.gz
crawl-ref-a595b7fd82f3d7c054f4a28f6b2d5770e6aade15.zip
[1626830] Fixed non-stacking potions.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@782 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index dcab9825a2..ff8ed47ef2 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1308,6 +1308,16 @@ bool is_stackable_item( const item_def &item )
return (false);
}
+int ident_flags(const item_def &item)
+{
+ int flags = item.flags & full_ident_mask(item);
+
+ if (!(flags & ISFLAG_KNOW_TYPE) && item_type_known(item))
+ flags |= ISFLAG_KNOW_TYPE;
+
+ return (flags);
+}
+
bool items_stack( const item_def &item1, const item_def &item2 )
{
// both items must be stackable
@@ -1334,8 +1344,7 @@ bool items_stack( const item_def &item1, const item_def &item2 )
}
// Check the ID flags
- if ( (item1.flags & full_ident_mask(item1)) !=
- (item2.flags & full_ident_mask(item2)) )
+ if (ident_flags(item1) != ident_flags(item2))
return false;
// Check the non-ID flags
@@ -1343,14 +1352,14 @@ bool items_stack( const item_def &item1, const item_def &item2 )
(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 )))
+ (!item_type_known(item1) || !item_type_known(item2)))
+ {
return false;
+ }
return (true);
}