Brief: //dnl ch66

- Fix problems with left click on NAS pocket with weapon and attachment in hand also do some patch to JA2SP_INVENTORY_AP inventory manipulation.
Details:
- If have valid attachment for weapon in some NAS pocket and try left click on it weapon will be transfered to HANDPOS, this is fix and attachment box will pop up instead.
- Fix problem with inventory manipulation on when they deduct APs from even on unsuccessful item movement.
- From now during turn based combat you can only attach and reload weapon in your HANDPOS and item handling is forbidden in strategic map as code for APs deduction for item movement is only implemented in tactical screen. So this restrictions apply only during turn based combat and with JA2SP_INVENTORY_AP is turned on.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6375 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-09-08 08:19:19 +00:00
parent 841e88d632
commit 570fccf768
2 changed files with 16 additions and 3 deletions
+3
View File
@@ -9441,6 +9441,9 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason )
return;
}
if(gGameOptions.fInventoryCostsAP && (gTacticalStatus.uiFlags & INCOMBAT))//dnl ch66 070913 if fInventoryCostsAP is set and we are in combat then moving equipment in strategic screen is not allowed
return;
// make sure we're here legally
Assert( MapCharacterHasAccessibleInventory( bSelectedInfoChar ) );
+13 -3
View File
@@ -420,6 +420,7 @@ extern void HandleAnyMercInSquadHasCompatibleStuff( UINT8 ubSquad, OBJECTTYPE *p
extern void SetNewItem( SOLDIERTYPE *pSoldier, UINT8 ubInvPos, BOOLEAN fNewItem );
extern BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier, UINT8 ubPosition );
extern BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTestObject, BOOLEAN fOn );
extern BOOLEAN CompatibleAmmoForGun( OBJECTTYPE *pTryObject, OBJECTTYPE *pTestObject );//dnl ch66 070913
BOOLEAN IsMouseInRegion( MOUSE_REGION *pRegion );
void HandleMouseOverSoldierFaceForContMove( SOLDIERTYPE *pSoldier, BOOLEAN fOn );
@@ -3851,6 +3852,8 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
if ( ubSrcID == ubDestID )
{
if(!CanItemFitInPosition(gpSMCurrentMerc, gpItemPointer, (INT8)uiHandPos, FALSE))//dnl ch66 070913
return;
if (INV_AP_COST)
//Jenilee: determine the cost of moving this item around in our inventory
usCostToMoveItem = GetInvMovementCost(gpItemPointer, uiLastHandPos, uiHandPos);
@@ -3861,7 +3864,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
if ( ( usCostToMoveItem == 0 ) || ( gpSMCurrentMerc->bActionPoints >= usCostToMoveItem ) )
{
fOKToGo = TRUE;
uiLastHandPos = uiHandPos;
//uiLastHandPos = uiHandPos;//dnl ch66 070913 this should be set after we move item
}
else //we dont have enough APs to move it to this slot, show a warning message
{
@@ -3952,11 +3955,13 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
return;
}
if ( uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS || uiHandPos == HELMETPOS || uiHandPos == VESTPOS || uiHandPos == LEGPOS )
//if ( uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS || uiHandPos == HELMETPOS || uiHandPos == VESTPOS || uiHandPos == LEGPOS )//dnl ch66 070913 without this condition we have option to attach and merge with left click too, and solve problem with CanItemFitInPosition which return TRUE if slot has weapon and we try to put clip or attachment or grenade which fits
{
//if ( ValidAttachmentClass( usNewItemIndex, usOldItemIndex ) )
if ( ValidAttachment( usNewItemIndex, &(gpSMCurrentMerc->inv[uiHandPos]) ) )
{
if(INV_AP_COST && (gTacticalStatus.uiFlags & INCOMBAT) && !(uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS || uiHandPos == HELMETPOS || uiHandPos == VESTPOS || uiHandPos == LEGPOS))//dnl ch66 070913 if INV_AP_COST is active then attach or merge is allowed only in those slots
return;
// it's an attempt to attach; bring up the inventory panel
if ( !InItemDescriptionBox( ) )
{
@@ -3966,6 +3971,8 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
}
else if ( ValidMerge( usNewItemIndex, usOldItemIndex ) )
{
if(INV_AP_COST && (gTacticalStatus.uiFlags & INCOMBAT) && !(uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS || uiHandPos == HELMETPOS || uiHandPos == VESTPOS || uiHandPos == LEGPOS))//dnl ch66 070913 if INV_AP_COST is active then attach or merge is allowed only in those slots
return;
// bring up merge requestor
gubHandPos = (UINT8) uiHandPos;
gusOldItemIndex = usOldItemIndex;
@@ -3984,6 +3991,8 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
DoMessageBox( MSG_BOX_BASIC_STYLE, Message[ STR_MERGE_ITEMS ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, MergeMessageBoxCallBack, NULL );
return;
}
else if(INV_AP_COST && (gTacticalStatus.uiFlags & INCOMBAT) && !(uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS) && CompatibleAmmoForGun(gpItemPointer, &gpSMCurrentMerc->inv[uiHandPos]))//dnl ch66 070913 if INV_AP_COST is active then reload is not allowed if weapon not in HANDPOS
return;
// else handle normally
}
@@ -4022,6 +4031,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
// try to place the item in the cursor into this inventory slot
if ( UIHandleItemPlacement( (UINT8) uiHandPos, usOldItemIndex, usNewItemIndex, fDeductPoints ) )
{
uiLastHandPos = uiHandPos;//dnl ch66 070913
//Jenilee: pay the price
//just make sure to handle that if we are putting it back in the SAME slot, the cost should be 0!!!
gpSMCurrentMerc->bActionPoints -= usCostToMoveItem;
@@ -4135,7 +4145,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
// access description box directly if CTRL is pressed for stack items
if( !( ( gpSMCurrentMerc->inv[ uiHandPos ].ubNumberOfObjects > 1 && isLimit > 0 ) && ( guiCurrentScreen != MAP_SCREEN ) ) || _KeyDown( CTRL ) )
{
if ( !InItemDescriptionBox( ) )
if ( !InItemDescriptionBox( ) && !(INV_AP_COST && (gTacticalStatus.uiFlags & INCOMBAT) && !(uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS || uiHandPos == HELMETPOS || uiHandPos == VESTPOS || uiHandPos == LEGPOS)) )//dnl ch66 070913 if INV_AP_COST is active then attach is not allowed if not in one of these slots
{
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) )
{