mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Move iter->exists() check to first
This commit is contained in:
@@ -1423,7 +1423,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
|
||||
for (attachmentList::iterator iter = seperateObject[0]->attachments.begin(); iter != seperateObject[0]->attachments.end();) {
|
||||
// ARM: Note: this is only used for selling, not repairs, so attachmentes are seperated when sold to a dealer
|
||||
// If the attachment is detachable
|
||||
if (! (Item[ iter->usItem ].inseparable ) && iter->exists())
|
||||
if (! (iter->exists() && Item[ iter->usItem ].inseparable))
|
||||
{
|
||||
// add this particular attachment (they can't be imprinted, or themselves have attachments!)
|
||||
AddObjectToArmsDealerInventory( ubArmsDealer, &(*iter) );
|
||||
@@ -1931,7 +1931,7 @@ UINT32 CalculateObjectItemRepairTime( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
|
||||
// add time to repair any attachments on it
|
||||
for (attachmentList::iterator iter = (*pItemObject)[x]->attachments.begin(); iter != (*pItemObject)[x]->attachments.end(); ++iter) {
|
||||
// if damaged and repairable
|
||||
if ( ( (*iter)[x]->data.objectStatus < 100 ) && CanDealerRepairItem( ubArmsDealer, iter->usItem ) && iter->exists())
|
||||
if ( iter->exists() && ( (*iter)[x]->data.objectStatus < 100 ) && CanDealerRepairItem( ubArmsDealer, iter->usItem ) )
|
||||
{
|
||||
//uiRepairTime += CalculateSimpleItemRepairTime( ubArmsDealer, iter->usItem, (*iter)[x]->data.objectStatus );
|
||||
uiRepairTime += CalculateObjectItemRepairTime( ubArmsDealer, &(*iter) );
|
||||
@@ -1988,7 +1988,7 @@ UINT32 CalculateObjectItemRepairCost( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
|
||||
// add cost of repairing any attachments on it
|
||||
for (attachmentList::iterator iter = (*pItemObject)[x]->attachments.begin(); iter != (*pItemObject)[x]->attachments.end(); ++iter) {
|
||||
// if damaged and repairable
|
||||
if ( ( (*iter)[x]->data.objectStatus < 100 ) && CanDealerRepairItem( ubArmsDealer, iter->usItem ) && iter->exists())
|
||||
if ( iter->exists() && ( (*iter)[x]->data.objectStatus < 100 ) && CanDealerRepairItem( ubArmsDealer, iter->usItem ) )
|
||||
{
|
||||
uiRepairCost += CalculateObjectItemRepairCost( ubArmsDealer, &(*iter));
|
||||
}
|
||||
|
||||
+21
-21
@@ -1995,7 +1995,7 @@ OBJECTTYPE* FindAttachment( OBJECTTYPE * pObj, UINT16 usItem, UINT8 subObject )
|
||||
{
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) {
|
||||
if (iter->usItem == usItem && iter->exists())
|
||||
if ( iter->exists() && iter->usItem == usItem )
|
||||
{
|
||||
return &(*iter);
|
||||
}
|
||||
@@ -2008,7 +2008,7 @@ OBJECTTYPE* FindAttachmentByClass( OBJECTTYPE * pObj, UINT32 uiItemClass, UINT8
|
||||
{
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].usItemClass == uiItemClass && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass == uiItemClass )
|
||||
{
|
||||
return &(*iter);
|
||||
}
|
||||
@@ -2021,7 +2021,7 @@ OBJECTTYPE* FindAttachmentByAttachmentClass( OBJECTTYPE * pObj, UINT32 uiAttachm
|
||||
{
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].attachmentclass == uiAttachmentClass && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].attachmentclass == uiAttachmentClass )
|
||||
{
|
||||
return &(*iter);
|
||||
}
|
||||
@@ -2139,7 +2139,7 @@ OBJECTTYPE* FindNonSmokeLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon
|
||||
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (ValidLaunchable( iter->usItem, usWeapon) && Explosive[Item[iter->usItem].ubClassIndex].ubType != EXPLOSV_SMOKE && iter->exists())
|
||||
if ( iter->exists() && ValidLaunchable( iter->usItem, usWeapon) && Explosive[Item[iter->usItem].ubClassIndex].ubType != EXPLOSV_SMOKE )
|
||||
{
|
||||
return &(*iter);
|
||||
}
|
||||
@@ -10422,7 +10422,7 @@ BOOLEAN NCTHIsScoped( OBJECTTYPE * pObj )
|
||||
return TRUE;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if ( Item[iter->usItem].scopemagfactor > 1.0 && iter->exists() )
|
||||
if ( iter->exists() && Item[iter->usItem].scopemagfactor > 1.0 )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -10441,7 +10441,7 @@ BOOLEAN IsScoped( OBJECTTYPE * pObj )
|
||||
return TRUE;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if ( Item[iter->usItem].aimbonus > 0 && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].aimbonus > 0 )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -10528,7 +10528,7 @@ INT16 GetBaseScopeAimBonus( OBJECTTYPE * pObj, INT32 iRange )
|
||||
//Search for the most powerful scope we can use.
|
||||
for(attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); iter++)
|
||||
{
|
||||
if(Item[iter->usItem].aimbonus > bonus && iRange >= Item[iter->usItem].minrangeforaimbonus && iter->exists())
|
||||
if( iter->exists() && Item[iter->usItem].aimbonus > bonus && iRange >= Item[iter->usItem].minrangeforaimbonus )
|
||||
{
|
||||
bonus = Item[iter->usItem].aimbonus;
|
||||
}
|
||||
@@ -10606,7 +10606,7 @@ UINT32 FindRangeBonusAttachment( OBJECTTYPE * pObj )
|
||||
{
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].rangebonus > 0 && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].rangebonus > 0 )
|
||||
{
|
||||
return( Item[iter->usItem].uiIndex );
|
||||
}
|
||||
@@ -10627,7 +10627,7 @@ INT16 GetRangeBonus( OBJECTTYPE * pObj )
|
||||
bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].rangebonus;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if ( !ItemIsDuckbill(iter->usItem) || (ItemIsDuckbill(iter->usItem) && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT ) && iter->exists())
|
||||
if ( iter->exists() && !ItemIsDuckbill(iter->usItem) || (ItemIsDuckbill(iter->usItem) && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT ) )
|
||||
bonus += BonusReduce( Item[iter->usItem].rangebonus, (*iter)[0]->data.objectStatus );
|
||||
}
|
||||
}
|
||||
@@ -12053,7 +12053,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||
OBJECTTYPE* pObj = &pSoldier->inv[HANDPOS];
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (ItemIsThermalOptics(iter->usItem) && iter->exists() )
|
||||
if ( iter->exists() && ItemIsThermalOptics(iter->usItem) )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -12110,7 +12110,7 @@ BOOLEAN IsDuckbill( OBJECTTYPE * pObj )
|
||||
return TRUE;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (ItemIsDuckbill(iter->usItem) && iter->exists() )
|
||||
if ( iter->exists() && ItemIsDuckbill(iter->usItem) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -12161,7 +12161,7 @@ BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj )
|
||||
// return TRUE;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if ( IsAttachmentClass( iter->usItem, AC_DETONATOR ) && iter->exists() )
|
||||
if ( iter->exists() && IsAttachmentClass( iter->usItem, AC_DETONATOR ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -12177,7 +12177,7 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj )
|
||||
// return TRUE;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if ( IsAttachmentClass( iter->usItem, AC_REMOTEDET ) && iter->exists() )
|
||||
if ( iter->exists() && IsAttachmentClass( iter->usItem, AC_REMOTEDET ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -12449,7 +12449,7 @@ OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj )
|
||||
{
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (ItemIsBatteries(iter->usItem) && iter->exists())
|
||||
if ( iter->exists() && ItemIsBatteries(iter->usItem) )
|
||||
{
|
||||
return( &(*iter) );
|
||||
}
|
||||
@@ -12681,7 +12681,7 @@ INT16 GetCamoBonus( OBJECTTYPE * pObj )
|
||||
bonus = (Item[pObj->usItem].camobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (!ItemIsCamoKit(iter->usItem) && iter->exists())
|
||||
if ( iter->exists() && !ItemIsCamoKit(iter->usItem) )
|
||||
bonus += (INT16) (Item[iter->usItem].camobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100));
|
||||
}
|
||||
}
|
||||
@@ -12694,7 +12694,7 @@ INT16 GetUrbanCamoBonus( OBJECTTYPE * pObj )
|
||||
bonus = (Item[pObj->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (!ItemIsCamoKit(iter->usItem) && iter->exists())
|
||||
if ( iter->exists() && !ItemIsCamoKit(iter->usItem) )
|
||||
bonus += (INT16) (Item[iter->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100));
|
||||
}
|
||||
}
|
||||
@@ -12707,7 +12707,7 @@ INT16 GetDesertCamoBonus( OBJECTTYPE * pObj )
|
||||
bonus = (Item[pObj->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (!ItemIsCamoKit(iter->usItem) && iter->exists())
|
||||
if ( iter->exists() && !ItemIsCamoKit(iter->usItem) )
|
||||
bonus += (INT16) (Item[iter->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100));
|
||||
}
|
||||
}
|
||||
@@ -12720,7 +12720,7 @@ INT16 GetSnowCamoBonus( OBJECTTYPE * pObj )
|
||||
bonus = (Item[pObj->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (!ItemIsCamoKit(iter->usItem) && iter->exists())
|
||||
if ( iter->exists() && !ItemIsCamoKit(iter->usItem) )
|
||||
bonus += (INT16) (Item[iter->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100));
|
||||
}
|
||||
}
|
||||
@@ -13165,7 +13165,7 @@ OBJECTTYPE* FindNightGogglesInInv( SOLDIERTYPE * pSoldier, INT8 * bSlot, BOOLEAN
|
||||
if (searchAllInventory) {
|
||||
for (UINT8 loop = 0; loop < pSoldier->inv[bLoop].ubNumberOfObjects; loop ++){
|
||||
for (attachmentList::iterator iter = pSoldier->inv[bLoop][loop]->attachments.begin(); iter != pSoldier->inv[bLoop][loop]->attachments.end(); ++iter) {
|
||||
if ( Item[ iter->usItem ].cavevisionrangebonus > bonusToBeat && Item[ iter->usItem ].usItemClass == IC_FACE && iter->exists() ) {
|
||||
if ( iter->exists() && Item[ iter->usItem ].cavevisionrangebonus > bonusToBeat && Item[ iter->usItem ].usItemClass == IC_FACE ) {
|
||||
pGoggles = &(*iter);
|
||||
*bSlot = bLoop;
|
||||
*isAttach = TRUE;
|
||||
@@ -14141,7 +14141,7 @@ INT16 GetAverageBestLaserRange( OBJECTTYPE * pObj )
|
||||
}
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
|
||||
{
|
||||
if (Item[iter->usItem].bestlaserrange > 0 && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].bestlaserrange > 0 )
|
||||
{
|
||||
numModifiers++;
|
||||
bonus += (FLOAT) Item[iter->usItem].bestlaserrange;
|
||||
@@ -14167,7 +14167,7 @@ INT16 GetBestLaserRange( OBJECTTYPE * pObj )
|
||||
}
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
|
||||
{
|
||||
if (Item[iter->usItem].bestlaserrange > range && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].bestlaserrange > range )
|
||||
{
|
||||
range = Item[iter->usItem].bestlaserrange;
|
||||
}
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ INT32 GetSpreadPattern( OBJECTTYPE * pObj )
|
||||
//If there are attachments, check them. Stop on the first one with something defined.
|
||||
//Dear God, I hate C++ iterators. What a fugly mess. //WarmSteel - I made it even messier ;3
|
||||
for (attachmentList::iterator iter = pObj[0][0]->attachments.begin(); iter != pObj[0][0]->attachments.end(); ++iter){
|
||||
if( (n=Item[ iter->usItem ].spreadPattern) && iter->exists()){
|
||||
if( iter->exists() && (n=Item[ iter->usItem ].spreadPattern) ){
|
||||
//An attachment has it, and it trumps everything, so return it's value.
|
||||
return n;}
|
||||
}
|
||||
|
||||
@@ -3031,7 +3031,7 @@ BOOLEAN RepairIsDone(DEALER_SPECIAL_ITEM* pSpecial)
|
||||
|
||||
// max condition of all permanent attachments on it
|
||||
for (attachmentList::iterator iter = RepairItem.ItemObject[0]->attachments.begin(); iter != RepairItem.ItemObject[0]->attachments.end(); ++iter) {
|
||||
if ( CanDealerRepairItem( gbSelectedArmsDealerID, iter->usItem ) && iter->exists())
|
||||
if ( iter->exists() && CanDealerRepairItem( gbSelectedArmsDealerID, iter->usItem ) )
|
||||
{
|
||||
// fix it up
|
||||
(*iter)[0]->data.objectStatus = 100;
|
||||
|
||||
@@ -147,7 +147,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier )
|
||||
{
|
||||
OBJECTTYPE* pObject = &(gusSelectedSoldier->inv[HANDPOS]);
|
||||
for (attachmentList::iterator iter = (*pObject)[0]->attachments.begin(); iter != (*pObject)[0]->attachments.end(); ++iter) {
|
||||
if ( Item[iter->usItem].visionrangebonus > 0 && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].visionrangebonus > 0 )
|
||||
{
|
||||
fMercIsUsingScope = TRUE;
|
||||
break;
|
||||
|
||||
@@ -6770,7 +6770,7 @@ void SwapGogglesUniformly(SOLDIERTYPE *pTeamSoldier, BOOLEAN fToNightVision)
|
||||
pObj = &(pTeamSoldier->inv[gear]);
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
|
||||
{
|
||||
if ( Item[ iter->usItem ].nightvisionrangebonus > bestBonus && Item[ iter->usItem ].usItemClass == IC_FACE && iter->exists())
|
||||
if ( iter->exists() && Item[ iter->usItem ].nightvisionrangebonus > bestBonus && Item[ iter->usItem ].usItemClass == IC_FACE )
|
||||
{
|
||||
pGoggles = &(*iter);
|
||||
bestBonus = Item[ iter->usItem ].nightvisionrangebonus;
|
||||
@@ -6818,7 +6818,7 @@ void SwapGogglesUniformly(SOLDIERTYPE *pTeamSoldier, BOOLEAN fToNightVision)
|
||||
pObj = &(pTeamSoldier->inv[gear]);
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
|
||||
{
|
||||
if ( Item[ iter->usItem ].brightlightvisionrangebonus > bestBonus && Item[ iter->usItem ].usItemClass == IC_FACE && iter->exists())
|
||||
if ( iter->exists() && Item[ iter->usItem ].brightlightvisionrangebonus > bestBonus && Item[ iter->usItem ].usItemClass == IC_FACE )
|
||||
{
|
||||
pGoggles = &(*iter);
|
||||
bestBonus = Item[ iter->usItem ].brightlightvisionrangebonus;
|
||||
|
||||
@@ -2081,7 +2081,7 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEA
|
||||
//sevenfm this should be checked only for guns because we can throw items with attached explosives
|
||||
if(Item[pObj->usItem].usItemClass & IC_WEAPON )
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if ( Item[ iter->usItem ].usItemClass & IC_EXPLOSV && iter->exists())
|
||||
if ( iter->exists() && Item[ iter->usItem ].usItemClass & IC_EXPLOSV )
|
||||
{
|
||||
pObject = &(*iter);
|
||||
break;
|
||||
|
||||
@@ -1036,7 +1036,7 @@ INT32 EffectiveArmour( OBJECTTYPE * pObj )
|
||||
iValue = iValue * (*pObj)[0]->data.objectStatus * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 )
|
||||
{
|
||||
INT32 iValue2;
|
||||
|
||||
@@ -1214,7 +1214,7 @@ INT32 ExplosiveEffectiveArmour( OBJECTTYPE * pObj )
|
||||
}
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 )
|
||||
{
|
||||
INT32 iValue2;
|
||||
|
||||
@@ -1295,7 +1295,7 @@ INT16 FireEffectiveArmour( OBJECTTYPE * pObj )
|
||||
|
||||
for ( attachmentList::iterator iter = ( *pObj )[0]->attachments.begin(); iter != ( *pObj )[0]->attachments.end(); ++iter )
|
||||
{
|
||||
if ( Item[iter->usItem].usItemClass == IC_ARMOUR && ( *iter )[0]->data.objectStatus > 0 && iter->exists() )
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass == IC_ARMOUR && ( *iter )[0]->data.objectStatus > 0 )
|
||||
{
|
||||
iValue += Item[iter->usItem].sFireResistance * ( *iter )[0]->data.objectStatus / 100;
|
||||
}
|
||||
@@ -5111,7 +5111,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo )
|
||||
pObj = &(pSoldier->inv[HANDPOS]);
|
||||
attachmentList::iterator iter;
|
||||
for (iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if ( Item[ iter->usItem ].usItemClass & IC_EXPLOSV && iter->exists())
|
||||
if ( iter->exists() && Item[ iter->usItem ].usItemClass & IC_EXPLOSV )
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -8025,7 +8025,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i
|
||||
if (pArmour->exists() == true)
|
||||
{
|
||||
for (attachmentList::iterator iter = (*pArmour)[0]->attachments.begin(); iter != (*pArmour)[0]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 && iter->exists())
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 )
|
||||
{
|
||||
// bullet got through jacket; apply ceramic plate armour
|
||||
INT32 protection = ArmourProtection( pTarget, Item[iter->usItem].ubClassIndex, &((*iter)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit );
|
||||
@@ -8071,7 +8071,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i
|
||||
{
|
||||
//Madd: put any attachments that someone might have added to the armour in the merc's inventory
|
||||
for (attachmentList::iterator iter = (*pArmour)[0]->attachments.begin(); iter != (*pArmour)[0]->attachments.end(); ++iter) {
|
||||
if ( !AutoPlaceObject( pTarget, &(*iter), FALSE ) && iter->exists())
|
||||
if ( iter->exists() && !AutoPlaceObject( pTarget, &(*iter), FALSE ) )
|
||||
{ // put it on the ground
|
||||
AddItemToPool( pTarget->sGridNo, &(*iter), 1, pTarget->pathing.bLevel, 0 , -1 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user