Brief: //dnl ch65

- Fix not enough APs for unloaded ammo and removed attachment in map screen, however this will not solve problem if inventory manipulation is on.
Details:
- During the battle if you enter in strategic screen and remove attachment or unload clip and have no free slots to put them, you was stuck and need to reload game (other option was trash).
Now game check if you have enough APs for reload and attach back item.
- This fix solve same problem with clips in tactical screen too.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6367 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-09-06 18:30:52 +00:00
parent 6fd98f0bbb
commit 1201807b09
+2 -2
View File
@@ -5822,7 +5822,7 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason)
gfItemAmmoDown = FALSE;
//CHRISL: We dont' want to be able to reload guns using the ammo crate from this function
if(gpItemPointer != NULL && Magazine[Item[gpItemPointer->usItem].ubClassIndex].ubMagType >= AMMO_BOX)
if((gpItemPointer != NULL && Magazine[Item[gpItemPointer->usItem].ubClassIndex].ubMagType >= AMMO_BOX) || !EnoughPoints(gpItemDescSoldier, APBPConstants[AP_RELOAD_GUN], 0, TRUE))//dnl ch65 040913
{
fInterfacePanelDirty = DIRTYLEVEL2;
btn->uiFlags &= (~BUTTON_CLICKED_ON );
@@ -6100,7 +6100,7 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason )
else
{
// ATE: Make sure we have enough AP's to drop it if we pick it up!
if ( pAttachment->exists() && EnoughPoints( gpItemDescSoldier, ( AttachmentAPCost( pAttachment->usItem, gpItemDescObject, gpItemPointerSoldier ) + APBPConstants[AP_PICKUP_ITEM] ), 0, TRUE ) )
if ( pAttachment->exists() && (guiCurrentScreen==MAP_SCREEN ? EnoughPoints(gpItemDescSoldier, 2*AttachmentAPCost(pAttachment->usItem, gpItemDescObject, gpItemPointerSoldier), 0, TRUE) : EnoughPoints(gpItemDescSoldier, AttachmentAPCost(pAttachment->usItem, gpItemDescObject, gpItemPointerSoldier)+APBPConstants[AP_PICKUP_ITEM], 0, TRUE)) )//dnl ch65 040913 on map screen we cannot drop so check if we have double APs for remove and attach
{
// Flugente: if we are trying to remove the detonators of an armed bomb, auto-fail: it explodes
if ( gpItemPointerSoldier && ( (Item[gpItemDescObject->usItem].usItemClass & (IC_BOMB)) && ( ( (*gpItemDescObject)[ubStatusIndex]->data.misc.bDetonatorType == BOMB_TIMED ) || ( (*gpItemDescObject)[ubStatusIndex]->data.misc.bDetonatorType == BOMB_REMOTE ) ) ) )