diff options
author | Dániel Juhász <juhdanad@gmail.com> | 2017-06-20 09:19:56 +0000 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-20 11:19:56 +0200 |
commit | 0fcaf9fb1b61caaf8ed78a5d3005b1d9d1c43b57 (patch) | |
tree | 39b19a3fa61dc29b921739a26d7598222cdbd5f3 /src/inventory.cpp | |
parent | 7c07cb4ec23ebb0f3d5f3d913bea205660515836 (diff) | |
download | minetest-0fcaf9fb1b61caaf8ed78a5d3005b1d9d1c43b57.tar.gz minetest-0fcaf9fb1b61caaf8ed78a5d3005b1d9d1c43b57.tar.bz2 minetest-0fcaf9fb1b61caaf8ed78a5d3005b1d9d1c43b57.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.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 25f524150..5ce82737a 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -658,7 +658,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) @@ -669,9 +669,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; |