mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Bugfix for item handling
When you click at an item with a valid attachment at the hand cursor the game will no longer move that item to an empty slot and instead open the UDB. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6401 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3954,27 +3954,22 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
// we allow attaching on items in any slot
|
||||
if ( ValidAttachment( usNewItemIndex, &(gpSMCurrentMerc->inv[uiHandPos]) ) )
|
||||
{
|
||||
//if ( ValidAttachmentClass( usNewItemIndex, usOldItemIndex ) )
|
||||
if ( ValidAttachment( usNewItemIndex, &(gpSMCurrentMerc->inv[uiHandPos]) ) )
|
||||
// it's an attempt to attach; bring up the inventory panel
|
||||
if ( !InItemDescriptionBox( ) )
|
||||
{
|
||||
// removed because of problems with attaching when INV_AP_COST is on
|
||||
// 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( ) )
|
||||
{
|
||||
InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, ITEMDESC_START_X, ITEMDESC_START_Y, 0 );
|
||||
}
|
||||
return;
|
||||
InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, ITEMDESC_START_X, ITEMDESC_START_Y, 0 );
|
||||
}
|
||||
else if ( ValidMerge( usNewItemIndex, usOldItemIndex ) )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS || uiHandPos == HELMETPOS || uiHandPos == VESTPOS || uiHandPos == LEGPOS )
|
||||
{
|
||||
if ( ValidMerge( usNewItemIndex, usOldItemIndex ) )
|
||||
{
|
||||
// removed because of problems with putting items on top of stack when INV_AP_COST is on
|
||||
// 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;
|
||||
@@ -3993,9 +3988,6 @@ 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;
|
||||
}
|
||||
// removed because of problems when INV_AP_COST is on
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -4148,8 +4140,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 ) )
|
||||
{
|
||||
// removed fix because it causes UDB to become inaccessible for all other slots than those listed
|
||||
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 ( !InItemDescriptionBox( ) )
|
||||
{
|
||||
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 ) )
|
||||
{
|
||||
@@ -7984,4 +7975,3 @@ BOOLEAN HandleKlerykPistolet( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, UINT16 us
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user