Moved armed vehicle/robot in gas check into function

Originally placed in DecideAction(green/yellow/red/black) functions separately
This commit is contained in:
Asdow
2023-08-18 23:11:39 +03:00
parent 613de1b869
commit 06478266d0
2 changed files with 12 additions and 18 deletions
+12
View File
@@ -2253,6 +2253,12 @@ BOOLEAN InWaterGasOrSmoke( SOLDIERTYPE *pSoldier, INT32 sGridNo )
BOOLEAN InGasOrSmoke( SOLDIERTYPE *pSoldier, INT32 sGridNo )
{
// Armed vehicles and robots do not care about gas or smoke
if (ARMED_VEHICLE(pSoldier) || ENEMYROBOT(pSoldier))
{
return FALSE;
}
// smoke
if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_SIGNAL_SMOKE | MAPELEMENT_EXT_DEBRIS_SMOKE | MAPELEMENT_EXT_FIRERETARDANT_SMOKE ) )
return TRUE;
@@ -2300,6 +2306,12 @@ BOOLEAN InGas(SOLDIERTYPE *pSoldier, INT32 sGridNo)
if (TileIsOutOfBounds(sGridNo))
return FALSE;
// Armed vehicles and robots do not care about gas or smoke
if (ARMED_VEHICLE(pSoldier) || ENEMYROBOT(pSoldier))
{
return FALSE;
}
if (InGasSpot(pSoldier, sGridNo, pSoldier->pathing.bLevel))
{
return TRUE;
-18
View File
@@ -807,12 +807,6 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
// check if standing in tear gas without a gas mask on, or in smoke
bInGas = InGasOrSmoke( pSoldier, pSoldier->sGridNo );
// Flugente: tanks do not care about gas
if ( ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier ) )
{
bInGas = FALSE;
}
// if real-time, and not in the way, do nothing 90% of the time (for GUARDS!)
// unless in water (could've started there), then we better swim to shore!
@@ -2589,12 +2583,6 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier)
// check if standing in tear gas without a gas mask on
bInGas = InGasOrSmoke( pSoldier, pSoldier->sGridNo );
// Flugente: tanks do not care about gas
if ( ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier ) )
{
bInGas = FALSE;
}
////////////////////////////////////////////////////////////////////////////
// WHEN LEFT IN GAS, WEAR GAS MASK IF AVAILABLE AND NOT WORN
////////////////////////////////////////////////////////////////////////////
@@ -5042,12 +5030,6 @@ INT16 ubMinAPCost;
// check if standing in tear gas without a gas mask on
bInGas = InGasOrSmoke( pSoldier, pSoldier->sGridNo );
// Flugente: tanks do not care about gas
if ( ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier ) )
{
bInGas = FALSE;
}
// calculate our morale
pSoldier->aiData.bAIMorale = CalcMorale(pSoldier);