Skip to content

Commit ad61025

Browse files
committed
fix: upgrade panel not properly comparing item for cancel
The Upgrade Panel was just exiting any time GC objects got updated. We can instead use the ItemDefIndex because upgrades persist across items of the same item def. This fixes an issue where party invites could be abused to prevent players from upgrading items in MvM, and it also fixes a bug where unrelated inventory updates would always close you out of the menu, as well as lobby updates (players disconnecting/reconnecting) ref: ValveSoftware/Source-1-Games#4288
1 parent 7278536 commit ad61025

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/game/client/tf/player_vs_environment/c_tf_upgrades.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ void CHudUpgradePanel::PlayerInventoryChanged( C_TFPlayer *pPlayer )
716716
continue;
717717

718718
// If the item has changed since the panel was created, cancel out of the upgrade screen
719-
if ( pItemSlotBuyPanel->GetItemID() != pCurrentItem->GetItemID() )
719+
if ( pItemSlotBuyPanel->GetItemID() != pCurrentItem->GetItemDefIndex() )
720720
{
721721
OnCommand( "cancel" );
722722
return;
@@ -1149,7 +1149,7 @@ void CHudUpgradePanel::UpdateUpgradeButtons( void )
11491149
CEconItemView *pCurItemData = CTFPlayerSharedUtils::GetEconItemViewByLoadoutSlot( m_hPlayer, pItemSlotBuyPanel->nSlot );
11501150
if ( pCurItemData )
11511151
{
1152-
pItemSlotBuyPanel->SetItemID( pCurItemData->GetItemID() );
1152+
pItemSlotBuyPanel->SetItemID( pCurItemData->GetItemDefIndex() );
11531153
}
11541154

11551155
if ( !m_bInspectMode )

0 commit comments

Comments
 (0)