From 4ba2976817461ed83e9595bcacc7a37670be8ec9 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Tue, 25 Feb 2014 09:13:39 +0000 Subject: [PATCH] CTRL+LeftClick on an item with an attachment in the hand cursor would attach it without any AP costs. Now the game will deduct the correct attachment AP. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6974 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Panels.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 58663f0b..141d2000 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3946,7 +3946,16 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) for (UINT8 i = 0; iinv[ uiHandPos ].AttachObject(gpSMCurrentMerc,gpItemPointer,TRUE,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) ) + gpSMCurrentMerc->bActionPoints -= usCostToMoveItem; } } }