Skip to content

Commit

Permalink
Revert "Inventory: Make addItem for empty ItemStacks respect max stac…
Browse files Browse the repository at this point in the history
…k size" (#8519)

Revert commit e6a9e60
  • Loading branch information
ClobberXD authored and paramat committed May 12, 2019
1 parent 06a749c commit 5686941
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/inventory.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -335,6 +319,7 @@ bool ItemStack::itemFits(ItemStack newitem,

if(restitem)
*restitem = newitem;

return newitem.empty();
}

Expand Down

0 comments on commit 5686941

Please sign in to comment.