diff options
author | ANAND ︻气デ═一 <ClobberXD@gmail.com> | 2019-05-12 22:37:15 +0530 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2019-05-12 18:07:15 +0100 |
commit | 568694122cb662d6c6cb071338c9d30721372b50 (patch) | |
tree | 42645886cdc144609308fcfb8ff02d3c3b72bd5b /src | |
parent | 06a749c3863c3c45ccecb524b82633604ef44a0b (diff) | |
download | minetest-568694122cb662d6c6cb071338c9d30721372b50.tar.gz minetest-568694122cb662d6c6cb071338c9d30721372b50.tar.bz2 minetest-568694122cb662d6c6cb071338c9d30721372b50.zip |
Revert "Inventory: Make addItem for empty ItemStacks respect max stack size" (#8519)
Revert commit e6a9e60
Diffstat (limited to 'src')
-rw-r--r-- | src/inventory.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 2335136b1..40dc602d0 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -257,17 +257,8 @@ ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef) // If this is an empty item, it's an easy job. else if(empty()) { - const u16 stackMax = newitem.getStackMax(itemdef); - *this = newitem; - - // If the item fits fully, delete it - if (count <= stackMax) { - newitem.clear(); - } else { // Else the item does not fit fully. Return the rest. - count = stackMax; - newitem.remove(count); - } + newitem.clear(); } // If item name or metadata differs, bail out else if (name != newitem.name @@ -306,14 +297,7 @@ bool ItemStack::itemFits(ItemStack newitem, // If this is an empty item, it's an easy job. else if(empty()) { - const u16 stackMax = newitem.getStackMax(itemdef); - - // If the item fits fully, delete it - if (newitem.count <= stackMax) { - newitem.clear(); - } else { // Else the item does not fit fully. Return the rest. - newitem.remove(stackMax); - } + newitem.clear(); } // If item name or metadata differs, bail out else if (name != newitem.name @@ -335,6 +319,7 @@ bool ItemStack::itemFits(ItemStack newitem, if(restitem) *restitem = newitem; + return newitem.empty(); } |