summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-01-04 11:12:56 +0100
committerAdam Borowski <kilobyte@angband.pl>2010-01-04 11:12:56 +0100
commit20956f9f4cacafae1947b1d3200e5e5e2748b699 (patch)
tree4b4fa6503431af3256dc07cbae462d904ef06677 /crawl-ref/source/items.cc
parent0c8fe019ddaea7c80bd7a72bab958b729019991d (diff)
downloadcrawl-ref-20956f9f4cacafae1947b1d3200e5e5e2748b699.tar.gz
crawl-ref-20956f9f4cacafae1947b1d3200e5e5e2748b699.zip
Let chunks stack, if their age is similar.
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index ec73ef8cf7..9bae095a87 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1262,7 +1262,7 @@ bool is_stackable_item( const item_def &item )
return (false);
if (item.base_type == OBJ_MISSILES
- || (item.base_type == OBJ_FOOD && item.sub_type != FOOD_CHUNK)
+ || item.base_type == OBJ_FOOD
|| item.base_type == OBJ_SCROLLS
|| item.base_type == OBJ_POTIONS
|| item.base_type == OBJ_UNKNOWN_II
@@ -1299,11 +1299,14 @@ bool items_similar(const item_def &item1, const item_def &item2, bool ignore_ide
// These classes also require pluses and special.
if (item1.base_type == OBJ_WEAPONS // only throwing weapons
|| item1.base_type == OBJ_MISSILES
- || item1.base_type == OBJ_MISCELLANY) // only runes
+ || item1.base_type == OBJ_MISCELLANY // only runes
+ || item1.base_type == OBJ_FOOD) // chunks
{
if (item1.plus != item2.plus
|| item1.plus2 != item2.plus2
- || item1.special != item2.special)
+ || (item1.base_type == OBJ_FOOD && item2.sub_type == FOOD_CHUNK) ?
+ (item1.special != item2.special) :
+ (abs(item1.special - item2.special) > 5))
{
return (false);
}