mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Allow enemy to retreat (#279)
This check was preventing enemies from retreating into another sector if tactical AI retreat was enabled, leading into AI deadlock every time AI_ACTION_RUNAWAY was the decision.
This commit is contained in:
+11
-5
@@ -5081,11 +5081,17 @@ BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPe
|
|||||||
INT16 sDesiredLevel;
|
INT16 sDesiredLevel;
|
||||||
BOOLEAN fOKCheckStruct;
|
BOOLEAN fOKCheckStruct;
|
||||||
|
|
||||||
// sevenfm: allow civilians and NPCs with profile to go off screen
|
// Allow civilians and NPCs with profile to go off screen, and also enemies if tactical retreat is enabled
|
||||||
if (!GridNoOnVisibleWorldTile(sGridNo) && (pCurrSoldier->bTeam != CIV_TEAM || pCurrSoldier->ubProfile == NO_PROFILE))
|
auto destinationOffscreen = !(GridNoOnVisibleWorldTile(sGridNo));
|
||||||
{
|
auto hasProfile = pCurrSoldier->ubProfile != NO_PROFILE;
|
||||||
return(FALSE);
|
auto isCivilian = pCurrSoldier->bTeam == CIV_TEAM;
|
||||||
}
|
auto isEnemy = pCurrSoldier->bTeam == ENEMY_TEAM;
|
||||||
|
auto retreatAllowed = gGameExternalOptions.fAITacticalRetreat == true;
|
||||||
|
|
||||||
|
if (destinationOffscreen && !(isCivilian || hasProfile || (isEnemy && retreatAllowed)))
|
||||||
|
{
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY )
|
if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user