Another efficiency improvement for attachments validity check function - will not check all items in inventory to be a valid gun/ammo for tested item if the tested item is attachment/hidden addon (by Shadooow).

Significant improvement for the inventory panel item highlighting code on map screen. There is also a fix for wrong items highlighted when changing currently selected merc (by Shadooow).
Old code was constantly running update for highlights several times a second. Now it only happens when the mouse position first finds or loses an item in inventory.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8998 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-05-03 04:57:07 +00:00
parent d41c0f2f93
commit a9a6193a81
2 changed files with 29 additions and 25 deletions
+11 -12
View File
@@ -3290,9 +3290,9 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
}
}
}
//if ( !fFoundAttachment )
//{
//if the test object is hidden addon or attachment, it won't be ammunition or gun so skip this
if (!Item[pTestObject->usItem].hiddenaddon && !Item[pTestObject->usItem].attachment)
{
if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
{
for ( cnt = 0; cnt < invsize; ++cnt )
@@ -3332,17 +3332,16 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
}
}
}
//If we are currently NOT in the Shopkeeper interface
else if ( !(guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE) )
}
//If we are currently NOT in the Shopkeeper interface and item is not gun or ammo
if (!(guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE) && ((Item[pTestObject->usItem].usItemClass & IC_GUN) || (Item[pTestObject->usItem].usItemClass & IC_AMMO)))
{
if (CompatibleItemForApplyingOnMerc(pTestObject))
{
if ( CompatibleItemForApplyingOnMerc( pTestObject ) )
{
fFound = TRUE;
gbCompatibleApplyItem = fOn;
}
fFound = TRUE;
gbCompatibleApplyItem = fOn;
}
//}
}
if ( !fFound )
{