'Disease->Diagnose' assignment also checks for contaminated items and marks them permanently

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8595 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2018-08-15 19:20:08 +00:00
parent 7246b671f8
commit 2e86f6c0ef
12 changed files with 58 additions and 0 deletions
+28
View File
@@ -6240,6 +6240,34 @@ void HandleDiseaseDiagnosis()
}
}
}
// loop over the inventory and check for contaminated items
BOOLEAN contaminationfound = FALSE;
INT8 invsize = (INT8)pTeamSoldier->inv.size(); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ...
{
if ( pTeamSoldier->inv[bLoop].exists() )
{
OBJECTTYPE * pObj = &( pTeamSoldier->inv[bLoop] ); // ... get pointer for this item ...
if ( pObj != NULL ) // ... if pointer is not obviously useless ...
{
for ( INT16 i = 0; i < pObj->ubNumberOfObjects; ++i ) // ... there might be multiple items here (item stack), so for each one ...
{
if ( ( *pObj )[i]->data.sObjectFlag & INFECTED && !( ( *pObj )[i]->data.sObjectFlag & INFECTION_DIAGNOSED ) && Chance( skill ) )
{
( *pObj )[i]->data.sObjectFlag |= INFECTION_DIAGNOSED;
contaminationfound = TRUE;
}
}
}
}
}
if ( contaminationfound )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, szDiseaseText[TEXT_DISEASE_CONTAMINATION_FOUND], pTeamSoldier->GetName() );
}
}