Fix bricks not creating new stacks (#860)

Unintentionally, bricks were not creating new stacks if you tried to get another stack.  This prevents some missions from being completed.  This issue is now fixed
This commit is contained in:
David Markowitz 2022-11-30 01:04:46 -08:00 committed by GitHub
parent 09dfb6df3a
commit 63460ea00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,8 +209,10 @@ void InventoryComponent::AddItem(
auto stack = static_cast<uint32_t>(info.stackSize);
bool isBrick = inventoryType == eInventoryType::BRICKS || (stack == 0 && info.itemType == 1);
// info.itemType of 1 is item type brick
if (inventoryType == eInventoryType::BRICKS || (stack == 0 && info.itemType == 1)) {
if (isBrick) {
stack = UINT32_MAX;
} else if (stack == 0) {
stack = 1;
@ -233,7 +235,7 @@ void InventoryComponent::AddItem(
}
// If we have some leftover and we aren't bricks, make a new stack
while (left > 0 && !(inventoryType == eInventoryType::BRICKS || (stack == 0 && info.itemType == 1))) {
while (left > 0 && (!isBrick || (isBrick && !existing))) {
const auto size = std::min(left, stack);
left -= size;