diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 024705c7..8ae51471 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9770,18 +9770,22 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) for (UINT8 i = 0; iusItem, pSoldier->inv[uiHandPos].usItem, pSoldier); - // Flugente: backgrounds - usCostToMoveItem = (usCostToMoveItem * (100 + pSoldier->GetBackgroundValue(BG_INVENTORY))) / 100; - // do we have enough AP? - if (!EnoughPoints(pSoldier, usCostToMoveItem, 0, FALSE)) - return; - // only deduct AP if attachment was placed successfully. - if (pSoldier->inv[uiHandPos].AttachObject(pSoldier, gpItemPointer, TRUE, i)) + if ((gTacticalStatus.uiFlags & INCOMBAT) && pSoldier->bInSector) + { + // silversurfer: This didn't cost any AP. Why? CTRL + LeftClick should deduct the same AP as manual attachment in the EDB. + usCostToMoveItem = AttachmentAPCost(gpItemPointer->usItem, pSoldier->inv[uiHandPos].usItem, pSoldier); + // Flugente: backgrounds + usCostToMoveItem = (usCostToMoveItem * (100 + pSoldier->GetBackgroundValue(BG_INVENTORY))) / 100; + // do we have enough AP? + if (!EnoughPoints(pSoldier, usCostToMoveItem, 0, TRUE)) + return; pSoldier->bActionPoints -= usCostToMoveItem; + //this will force redraw APs shown at merc portrait + fCharacterInfoPanelDirty = TRUE; + } + if(pSoldier->inv[uiHandPos].AttachObject(pSoldier, gpItemPointer, TRUE, i)) + fTeamPanelDirty = TRUE;//this will fix merged items not updating when we hold stack of items in hand } - } } @@ -9922,7 +9926,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) } } - } + } // Flugente: we have to recheck our flashlights, as we changed items pSoldier->HandleFlashLights(); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index e33ac668..9c90f911 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3813,16 +3813,18 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) for (UINT8 i = 0; iusItem, gpSMCurrentMerc->inv[ uiHandPos ].usItem, gpSMCurrentMerc ); - // Flugente: backgrounds - usCostToMoveItem = (usCostToMoveItem * (100 + gpSMCurrentMerc->GetBackgroundValue(BG_INVENTORY))) / 100; - // do we have enough AP? - if ( !EnoughPoints( gpSMCurrentMerc, usCostToMoveItem, 0, FALSE ) ) - return; - // only deduct AP if attachment was placed successfully. - if ( gpSMCurrentMerc->inv[ uiHandPos ].AttachObject(gpSMCurrentMerc,gpItemPointer,TRUE,i) ) + if ((gTacticalStatus.uiFlags & INCOMBAT)) + { + // silversurfer: This didn't cost any AP. Why? CTRL + LeftClick should deduct the same AP as manual attachment in the EDB. + usCostToMoveItem = AttachmentAPCost(gpItemPointer->usItem, gpSMCurrentMerc->inv[uiHandPos].usItem, gpSMCurrentMerc); + // Flugente: backgrounds + usCostToMoveItem = (usCostToMoveItem * (100 + gpSMCurrentMerc->GetBackgroundValue(BG_INVENTORY))) / 100; + // do we have enough AP? + if (!EnoughPoints(gpSMCurrentMerc, usCostToMoveItem, 0, TRUE)) + return; gpSMCurrentMerc->bActionPoints -= usCostToMoveItem; + } + gpSMCurrentMerc->inv[uiHandPos].AttachObject(gpSMCurrentMerc, gpItemPointer, TRUE, i); } } }