fixes for combining items with CTRL + LMB

- fixed regression causing this to substract APs in mapscreen even with no enemies in sector causing this to fail after several merges
- a "Not enough APs!" error will now show when doing this in turn based mode without enough APs
- fixed merc APs on portrait not being updated when doing this in mapscreen during fight
- fixed merged items not updating their graphic when doing this in mapscreen with stack of items in hand

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9069 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Shadooow
2021-06-09 20:10:39 +00:00
parent 807bd518b3
commit 90d5230c6e
2 changed files with 26 additions and 20 deletions
+15 -11
View File
@@ -9770,18 +9770,22 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason )
for (UINT8 i = 0; i<cnt;i++)
{
// 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, 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();
+11 -9
View File
@@ -3813,16 +3813,18 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
for (UINT8 i = 0; i<cnt;i++)
{
// 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, 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);
}
}
}