projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cd1d01b
)
Inventory: Handle removeItem leftovers (#8884)
author
SmallJoker
<SmallJoker@users.noreply.github.com>
Mon, 2 Sep 2019 17:30:36 +0000
(19:30 +0200)
committer
GitHub
<noreply@github.com>
Mon, 2 Sep 2019 17:30:36 +0000
(19:30 +0200)
src/inventory.cpp
patch
|
blob
|
history
diff --git
a/src/inventory.cpp
b/src/inventory.cpp
index 02e122416f255dc08acfe0d23c98c77660210b60..2a7c32a44dc2d53f99d0f957a79ddc781e8d2d26 100644
(file)
--- a/
src/inventory.cpp
+++ b/
src/inventory.cpp
@@
-680,7
+680,11
@@
ItemStack InventoryList::removeItem(const ItemStack &item)
for (auto i = m_items.rbegin(); i != m_items.rend(); ++i) {
if (i->name == item.name) {
u32 still_to_remove = item.count - removed.count;
- removed.addItem(i->takeItem(still_to_remove), m_itemdef);
+ ItemStack leftover = removed.addItem(i->takeItem(still_to_remove),
+ m_itemdef);
+ // Allow oversized stacks
+ removed.count += leftover.count;
+
if (removed.count == item.count)
break;
}