From 1201807b0935a38a2afef3667f3b5aede977bfcd Mon Sep 17 00:00:00 2001 From: Kriplo Date: Fri, 6 Sep 2013 18:30:52 +0000 Subject: [PATCH] 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 --- Tactical/Interface Items.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 33e1e1ee..11b6218e 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -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 ) ) ) )