Skip to content

Commit

Permalink
simplify SOLDIERTYPE::GetDiseaseContactProtection( )
Browse files Browse the repository at this point in the history
  • Loading branch information
majcosta committed Apr 4, 2024
1 parent 049ec47 commit dee2415
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Tactical/Soldier Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19938,22 +19938,19 @@ FLOAT SOLDIERTYPE::GetDiseaseContactProtection( )
// if we wear special equipment, lower our chances of being infected
FLOAT bestfacegear = 0.0f;
FLOAT bestprotectivegear = 0.0f;
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
for ( const auto &item : inv.get() )
{
if ( inv[bLoop].exists( ) )
if ( item.exists( ) )
{
OBJECTTYPE* pObj = &(inv[bLoop]);

if ( pObj && (*pObj)[0]->data.objectStatus >= USABLE )
if ( item[0]->data.objectStatus >= USABLE )
{
if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_1 ) )
if ( HasItemFlag( item.usItem, DISEASEPROTECTION_1 ) )
{
bestfacegear = max( bestfacegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) );
bestfacegear = max( bestfacegear, (FLOAT)(item[0]->data.objectStatus / 100) );
}
if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_2 ) )
if ( HasItemFlag( item.usItem, DISEASEPROTECTION_2 ) )
{
bestprotectivegear = max( bestprotectivegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) );
bestprotectivegear = max( bestprotectivegear, (FLOAT)(item[0]->data.objectStatus / 100) );
}
}
}
Expand Down

0 comments on commit dee2415

Please sign in to comment.