Skip to content

Commit

Permalink
Fixed local copies of items not respecting their Amount value
Browse files Browse the repository at this point in the history
  • Loading branch information
Boondorl authored and madame-rachelle committed Apr 21, 2024
1 parent c3b9dd7 commit 10a8a61
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions wadsrc/static/zscript/actors/inventory/inventory.zs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,10 @@ class Inventory : Actor
{
Inventory copy;

Amount = MIN(Amount, MaxAmount);
// Clamping this on local copy creation presents too many possible
// pitfalls (e.g. Health items).
if (!IsCreatingLocalCopy())
Amount = MIN(Amount, MaxAmount);
if (GoAway ())
{
copy = Inventory(Spawn (GetClass()));
Expand Down Expand Up @@ -1046,7 +1049,7 @@ class Inventory : Actor

protected bool GoAway ()
{
if (bCreatingCopy)
if (IsCreatingLocalCopy())
return true;

// Dropped items never stick around
Expand Down Expand Up @@ -1130,6 +1133,11 @@ class Inventory : Actor

return item;
}

protected clearscope bool IsCreatingLocalCopy() const
{
return bCreatingCopy;
}

//===========================================================================
//
Expand Down

0 comments on commit 10a8a61

Please sign in to comment.