summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
authorDániel Juhász <juhdanad@gmail.com>2017-06-20 09:19:56 +0000
committerSmallJoker <mk939@ymail.com>2018-06-03 17:31:59 +0200
commit322e5aaf9285e9686101393967f1a3c1e7db986c (patch)
tree27333ec46921d624cbe96b3d082a0cf189239e90 /src/inventory.cpp
parent03bc584f5738e21ef6c07e7c0928d0083be9995e (diff)
downloadminetest-322e5aaf9285e9686101393967f1a3c1e7db986c.tar.gz
minetest-322e5aaf9285e9686101393967f1a3c1e7db986c.tar.bz2
minetest-322e5aaf9285e9686101393967f1a3c1e7db986c.zip
Automatic item and node colorization (#5640)
* Automatic item and node colorization Now nodes with a palette yield colored item stacks, and colored items place colored nodes by default. The client predicts the colorization. * Backwards compatibility * Use nil * Style fixes * Fix code style * Document changes
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 8617f7263..ec8f3db72 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -659,7 +659,7 @@ bool InventoryList::roomForItem(const ItemStack &item_) const
return false;
}
-bool InventoryList::containsItem(const ItemStack &item) const
+bool InventoryList::containsItem(const ItemStack &item, bool match_meta) const
{
u32 count = item.count;
if(count == 0)
@@ -670,9 +670,9 @@ bool InventoryList::containsItem(const ItemStack &item) const
{
if(count == 0)
break;
- if(i->name == item.name)
- {
- if(i->count >= count)
+ if (i->name == item.name
+ && (!match_meta || (i->metadata == item.metadata))) {
+ if (i->count >= count)
return true;
else
count -= i->count;