From 08af7cca36208c65dabf0bc2450631a2fcd3cd37 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Thu, 30 Oct 2014 16:11:24 +0000 Subject: [PATCH] Fix: Inventory popups for LBE slots didn't work properly. LBE slots are supposed to return a pocket type of -1 because they are no pockets. Instead they returned 2 (Knife pocket). Fix: Inventory slots didn't show possible item amount anymore since r7600. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7619 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Items.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 2925133f..9c54af42 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -1767,7 +1767,8 @@ INT16 pocketTypeInSlot(SOLDIERTYPE *pSoldier, INT16 sPocket){ : LoadBearingEquipment[Item[pSoldier->inv[icLBE[sPocket]].usItem].ubClassIndex].lbePocketIndex[icPocket[sPocket]]; break; - case LBE_POCKET: + // silversurfer: LBE slots are NOT pockets! +/* case LBE_POCKET: if ( sPocket == VESTPOCKPOS ) lbePocket = 0; else if ( sPocket == LTHIGHPOCKPOS ) @@ -1779,11 +1780,13 @@ INT16 pocketTypeInSlot(SOLDIERTYPE *pSoldier, INT16 sPocket){ else if ( sPocket == BPACKPOCKPOS ) lbePocket = 4; + break;*/ + case OTHER_POCKET: if ( sPocket == GUNSLINGPOCKPOS ) // Gun Sling lbePocket = 1; - else + else // Knife lbePocket = 2; break; @@ -2332,7 +2335,7 @@ POPUP * createPopupForPocket( SOLDIERTYPE *pSoldier, INT16 sPocket ){ INT16 sX, sY; // get pocket type under cursor - INT16 lbePocket = pocketTypeInSlot(pSoldier, sPocket); + //INT16 lbePocket = pocketTypeInSlot(pSoldier, sPocket); /* if ( lbePocket != -1 ) { */ @@ -2702,7 +2705,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } else if ( !gfSMDisableForItems ) { - if ( gpItemPointer != NULL && !CanItemFitInPosition( pSoldier, gpItemPointer, (INT8)sPocket, FALSE ) ) + if ( gpItemPointer != NULL ) { // CHRISL: Display pocket capacity if we're holding something in the cursor if ( UsingNewInventorySystem( ) ) @@ -2717,15 +2720,15 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } // CHRISL: Change whether we hatch a pocket to be dependant on the current item - if ( (!UsingNewAttachmentSystem( ) && !ValidAttachment( gpItemPointer->usItem, pObject )) || + if ( CanItemFitInPosition( pSoldier, gpItemPointer, (INT8)sPocket, FALSE ) ) + { + fHatchItOut = FALSE; + } + else if (!UsingNewAttachmentSystem( ) && !ValidAttachment( gpItemPointer->usItem, pObject ) || (UsingNewAttachmentSystem( ) && !ValidItemAttachmentSlot( pObject, gpItemPointer->usItem, FALSE, FALSE )) ) { fHatchItOut = TRUE; } - else - { - fHatchItOut = FALSE; - } } else if ( pObject->exists( ) ) {