Use MAXITEMS + 1 max limit when checking transformations.

UpdateAttachmentTooltips: 
- separate items, launchables and attachments checks as they have different max limits
- improved searching of existing item in vector

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8924 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-01-31 13:48:21 +00:00
parent 1256639fe5
commit bc3b398b63
2 changed files with 95 additions and 70 deletions
+5 -5
View File
@@ -8498,7 +8498,7 @@ void HandleTacticalTransformItem(void)
BOOLEAN FindTransformation( UINT16 usItem, TransformInfoStruct **pTransformation )
{
// find transformation
for ( UINT32 x = 0; x < gMAXITEMS_READ; ++x )
for ( UINT32 x = 0; x < MAXITEMS + 1; ++x )
{
if ( Transform[x].usItem == (UINT16)-1 )
{
@@ -9034,7 +9034,7 @@ void HandleTacticalTransformFlashlight(void)
BOOLEAN FindLaserTransformation(UINT16 usItem, TransformInfoStruct **pTransformation)
{
// find transformation
for (INT32 x = 0; x < MAXITEMS; x++)
for (INT32 x = 0; x < MAXITEMS + 1; x++)
{
if (Transform[x].usItem == (UINT16)-1)
{
@@ -9060,7 +9060,7 @@ BOOLEAN FindScopeTransformation(UINT16 usItem, TransformInfoStruct **pTransforma
// search for higher magnification first
iFoundIndex = MAXITEMS;
scope = Item[usItem].scopemagfactor;
for (INT32 x = 0; x < MAXITEMS; x++)
for (INT32 x = 0; x < MAXITEMS + 1; x++)
{
if (Transform[x].usItem == (UINT16)-1)
{
@@ -9087,7 +9087,7 @@ BOOLEAN FindScopeTransformation(UINT16 usItem, TransformInfoStruct **pTransforma
// search for lowest magnification
iFoundIndex = MAXITEMS;
scope = Item[usItem].scopemagfactor;
for (INT32 x = 0; x < MAXITEMS; x++)
for (INT32 x = 0; x < MAXITEMS + 1; x++)
{
if (Transform[x].usItem == (UINT16)-1)
{
@@ -9111,7 +9111,7 @@ BOOLEAN FindScopeTransformation(UINT16 usItem, TransformInfoStruct **pTransforma
}
// search for any transformation
for (INT32 x = 0; x < MAXITEMS; x++)
for (INT32 x = 0; x < MAXITEMS + 1; x++)
{
if (Transform[x].usItem == (UINT16)-1)
{