Improved AI path tweaks.

FindBestNearbyCover: avoid moving into light if not in light already and not under attack.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8729 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-01-12 09:07:31 +00:00
parent f54a91718b
commit 168f9b9f6d
2 changed files with 23 additions and 13 deletions
+8 -7
View File
@@ -1038,6 +1038,14 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
continue;
}
// sevenfm: avoid moving into light
if (InLightAtNight(sGridNo, pSoldier->pathing.bLevel) &&
!InLightAtNight(pSoldier->sGridNo, pSoldier->pathing.bLevel) &&
!pSoldier->aiData.bUnderFire)
{
continue;
}
iPathCost = gubAIPathCosts[AI_PATHCOST_RADIUS + sXOffset][AI_PATHCOST_RADIUS + sYOffset];
/*
// water is OK, if the only good hiding place requires us to get wet, OK
@@ -2443,7 +2451,6 @@ INT32 FindClosestBoxingRingSpot( SOLDIERTYPE * pSoldier, BOOLEAN fInRing )
INT32 iDistance, iClosestDistance = 9999;
UINT16 usRoom;
SOLDIERTYPE *pDarren;
UINT8 ubLoop;
pDarren = FindSoldierByProfileID(DARREN, FALSE);
// set the distance limit of the square region
@@ -2455,12 +2462,6 @@ INT32 FindClosestBoxingRingSpot( SOLDIERTYPE * pSoldier, BOOLEAN fInRing )
sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1));
//NumMessage("sMaxRight = ",sMaxRight);
/*if ( (pSoldier->bTeam == gbPlayerNum) && (fInRing == FALSE) )
{
// have player not go to the left of the ring
sMaxLeft = 0;
}*/
// determine maximum vertical limits
sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW));
//NumMessage("sMaxUp = ",sMaxUp);