aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXunto <hunterdelyx1@gmail.com>2016-04-22 15:49:06 +0300
committerparamat <mat.gregory@virginmedia.com>2016-04-26 10:16:20 +0100
commitae7fb9b5bea291f81a82912d42fc43b7e71702bf (patch)
treeabb879415e8795d8b89ba27f37347e47d30ab116
parent31c1fca6fd5e200c4f4b24d7ba62b36a16494ed2 (diff)
downloadminetest-ae7fb9b5bea291f81a82912d42fc43b7e71702bf.tar.gz
minetest-ae7fb9b5bea291f81a82912d42fc43b7e71702bf.tar.bz2
minetest-ae7fb9b5bea291f81a82912d42fc43b7e71702bf.zip
Inventory: Make ItemStack with different metadata not stackable
-rw-r--r--src/inventory.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index fce8575e7..cb8faecbc 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -335,8 +335,9 @@ ItemStack ItemStack::addItem(const ItemStack &newitem_,
*this = newitem;
newitem.clear();
}
- // If item name differs, bail out
- else if(name != newitem.name)
+ // If item name or metadata differs, bail out
+ else if (name != newitem.name
+ || metadata != newitem.metadata)
{
// cannot be added
}
@@ -374,8 +375,9 @@ bool ItemStack::itemFits(const ItemStack &newitem_,
{
newitem.clear();
}
- // If item name differs, bail out
- else if(name != newitem.name)
+ // If item name or metadata differs, bail out
+ else if (name != newitem.name
+ || metadata != newitem.metadata)
{
// cannot be added
}