mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Inventory: Handle removeItem leftovers (#8884)
This commit is contained in:
parent
cd1d01b8b4
commit
f3acdd3914
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user