Items.cpp: MAXATTACHMENTS limit

lighting.cpp: check return values

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8258 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2016-06-25 09:18:47 +00:00
parent d2c1579786
commit fea2a0d12b
2 changed files with 60 additions and 51 deletions
+5 -3
View File
@@ -2332,7 +2332,8 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
}
if ( !fSameItem ) //Nav: why is this check here? fSameItem can only be false here, doesn't hurt I guess...
{
for(int i = 0;i<sizeof(IncompatibleAttachments);i++)
//for(int i = 0;i<sizeof(IncompatibleAttachments);i++)
for(int i = 0; i < MAXATTACHMENTS; i++)
{
if ( FindAttachment(pObj, usAttachment, subObject) != 0 && !IsAttachmentClass(usAttachment, (AC_GRENADE|AC_ROCKET|AC_MODPOUCH) ) )
{//Search for identical attachments unless we're dealing with rifle grenades
@@ -2516,7 +2517,8 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt
if ( !fSameItem )
{
for(int i = 0;i<sizeof(IncompatibleAttachments);i++)
//for(int i = 0;i<sizeof(IncompatibleAttachments);i++)
for(int i = 0; i < MAXATTACHMENTS; i++)
{
if ( FindAttachment(pObj, usAttachment, subObject) != 0 )
{
@@ -14946,7 +14948,7 @@ OBJECTTYPE* GetExternalFeedingObject(SOLDIERTYPE* pSoldier, OBJECTTYPE * pObject
// remember the caliber, magsize (TODO: really?) and type of ammo. They all have to fit
UINT8 ubCalibre = Weapon[usItem].ubCalibre;
UINT16 ubMagSize = Weapon[usItem].ubMagSize;
UINT8 ubAmmoType = ubAmmoType = (*pObject)[0]->data.gun.ubGunAmmoType;
UINT8 ubAmmoType = (*pObject)[0]->data.gun.ubGunAmmoType;
// now we now that this gun CAN be belt fed in the current situation. We now have to check if it IS
// we will first check for other mercs who might feed us. Afterwards we look into our own inventory