forked from Mirrorlandia_minetest/minetest
Revert "Inventory: Make addItem for empty ItemStacks respect max stack size" (#8519)
Revert commit e6a9e60
This commit is contained in:
parent
06a749c386
commit
568694122c
@ -257,17 +257,8 @@ ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef)
|
|||||||
// If this is an empty item, it's an easy job.
|
// If this is an empty item, it's an easy job.
|
||||||
else if(empty())
|
else if(empty())
|
||||||
{
|
{
|
||||||
const u16 stackMax = newitem.getStackMax(itemdef);
|
|
||||||
|
|
||||||
*this = newitem;
|
*this = newitem;
|
||||||
|
|
||||||
// If the item fits fully, delete it
|
|
||||||
if (count <= stackMax) {
|
|
||||||
newitem.clear();
|
newitem.clear();
|
||||||
} else { // Else the item does not fit fully. Return the rest.
|
|
||||||
count = stackMax;
|
|
||||||
newitem.remove(count);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If item name or metadata differs, bail out
|
// If item name or metadata differs, bail out
|
||||||
else if (name != newitem.name
|
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.
|
// If this is an empty item, it's an easy job.
|
||||||
else if(empty())
|
else if(empty())
|
||||||
{
|
{
|
||||||
const u16 stackMax = newitem.getStackMax(itemdef);
|
|
||||||
|
|
||||||
// If the item fits fully, delete it
|
|
||||||
if (newitem.count <= stackMax) {
|
|
||||||
newitem.clear();
|
newitem.clear();
|
||||||
} else { // Else the item does not fit fully. Return the rest.
|
|
||||||
newitem.remove(stackMax);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If item name or metadata differs, bail out
|
// If item name or metadata differs, bail out
|
||||||
else if (name != newitem.name
|
else if (name != newitem.name
|
||||||
@ -335,6 +319,7 @@ bool ItemStack::itemFits(ItemStack newitem,
|
|||||||
|
|
||||||
if(restitem)
|
if(restitem)
|
||||||
*restitem = newitem;
|
*restitem = newitem;
|
||||||
|
|
||||||
return newitem.empty();
|
return newitem.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user