mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Added LegalNPCDestination check to AI location search routines.
SearchForItems: avoid locations with bombs or red smoke danger. FindFlankingSpot: removed check for edge of the map. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8754 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1516,6 +1516,12 @@ INT32 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier)
|
||||
continue;
|
||||
}
|
||||
|
||||
// check that spot is allowed
|
||||
if (!LegalNPCDestination(pSoldier, sGridNo, IGNORE_PATH, NOWATER, 0))
|
||||
{
|
||||
continue; // skip on to the next potential grid
|
||||
}
|
||||
|
||||
// OK, this place shows potential. How useful is it as cover?
|
||||
//NumMessage("Promising seems gridno #",gridno);
|
||||
|
||||
@@ -2021,11 +2027,32 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
}
|
||||
|
||||
// exclude locations with tear/mustard gas (at this point, smoke is cool!)
|
||||
if ( InGasOrSmoke( pSoldier, sGridNo ) )
|
||||
if (InGas(pSoldier, sGridNo))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (FindBombNearby(pSoldier, sGridNo, BOMB_DETECTION_RANGE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// sevenfm: avoid staying at north edge
|
||||
/*if (NorthSpot(sGridNo, pSoldier->pathing.bLevel))
|
||||
{
|
||||
continue;
|
||||
}*/
|
||||
|
||||
if (RedSmokeDanger(sGridNo, pSoldier->pathing.bLevel))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!LegalNPCDestination(pSoldier, sGridNo, IGNORE_PATH, NOWATER, 0))
|
||||
{
|
||||
continue; // skip on to the next potential grid
|
||||
}
|
||||
|
||||
if ( (gpWorldLevelData[sGridNo].uiFlags & MAPELEMENT_ITEMPOOL_PRESENT)
|
||||
&& (gpWorldLevelData[sGridNo].uiFlags & MAPELEMENT_REACHABLE) )
|
||||
{
|
||||
@@ -2653,8 +2680,8 @@ INT32 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT32 sPos, INT8 bAction )
|
||||
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("FindFlankingSpot: orig loc = %d, loc to flank = %d", pSoldier->sGridNo , sPos));
|
||||
|
||||
// hit the edge of the map
|
||||
if ( FindNearestEdgePoint ( pSoldier->sGridNo ) == pSoldier->sGridNo )
|
||||
return NOWHERE;
|
||||
/*if ( FindNearestEdgePoint ( pSoldier->sGridNo ) == pSoldier->sGridNo )
|
||||
return NOWHERE;*/
|
||||
|
||||
// sevenfm: use max AP at the start of new turn
|
||||
//gubNPCAPBudget=(UINT8) (iSearchRange*3);
|
||||
@@ -2785,6 +2812,11 @@ INT32 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT32 sPos, INT8 bAction )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!LegalNPCDestination(pSoldier, sGridNo, IGNORE_PATH, WATEROK, 0))
|
||||
{
|
||||
continue; // skip on to the next potential grid
|
||||
}
|
||||
|
||||
// sevenfm: skip buildings if not in building already, because soldiers often run into buildings and stop flanking
|
||||
if (InARoom(sGridNo, NULL) && !InARoom(pSoldier->sGridNo, NULL))
|
||||
{
|
||||
|
||||
@@ -121,9 +121,6 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
|
||||
return(FALSE); // illegal destination
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int TryToResumeMovement(SOLDIERTYPE *pSoldier, INT32 sGridNo)
|
||||
{
|
||||
UINT8 ubGottaCancel = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user