Skip to content

Commit

Permalink
fix an issue where opening a box that is stacked on top of another bo…
Browse files Browse the repository at this point in the history
…x would make the game's UI think the player obtained both the contents of the top box and the bottom box
  • Loading branch information
BenLubar committed May 8, 2024
1 parent e1b6b13 commit 428e01c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/game/client/swarm/gameui/swarm/vitemshowcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,32 @@ void ItemShowcase::ShowItems( SteamInventoryResult_t hResult, int iStart, int iC
delete pInstance;
continue;
}

const ReactiveDropInventory::ItemDef_t *pDef = ReactiveDropInventory::GetItemDef( pInstance->ItemDefID );
if ( !pDef || pDef->GameOnly )
{
delete pInstance;
continue;
}

if ( const ReactiveDropInventory::ItemInstance_t *pPrev = ReactiveDropInventory::GetLocalItemCache( pInstance->ItemID ) )
{
if ( pPrev->Quantity > pInstance->Quantity )
{
// we consumed items from a stack
delete pInstance;
continue;
}
else if ( pPrev->Quantity < pInstance->Quantity && pDef->AutoStack )
{
// we added items to a stack
pInstance->Quantity -= pPrev->Quantity;
}
}

if ( pDef->AutoStack )
{
// replace previous versions of this item's state in the queue
bool bFound = false;
FOR_EACH_VEC( pItemShowcase->m_Queue, i )
{
Expand Down

0 comments on commit 428e01c

Please sign in to comment.