Skip to content

Commit 39e8d79

Browse files
committed
Use enemy exclusion radius for navpoint obstacles
1 parent 8aded6e commit 39e8d79

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Mammoth/TSE/CNavigationPath.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,20 @@ int CNavigationPath::ComputePath (CSystem *pSystem, CSovereign *pSovereign, cons
4848
{
4949
CSpaceObject *pObj = pSystem->GetObject(i);
5050
CSovereign *pObjSovereign;
51+
const CStationType *pEncounterType;
5152

5253
if (pObj == NULL)
5354
NULL;
5455
else if ((pObj->GetScale() == scaleStructure
5556
|| ((pObj->GetScale() == scaleShip) && (pObj->GetVel().Length2() < MIN_SPEED2)))
5657
&& (pObjSovereign = pObj->GetSovereign())
5758
&& (pObjSovereign->IsEnemy(pSovereign))
58-
&& pObj->CanAttack())
59+
&& pObj->CanAttack()
60+
&& (pEncounterType = pObj->GetEncounterInfo()))
5961
{
60-
CVector vUR = pObj->GetPos() + CVector(MAX_SAFE_DIST, MAX_SAFE_DIST);
61-
CVector vLL = pObj->GetPos() - CVector(MAX_SAFE_DIST, MAX_SAFE_DIST);
62+
Metric dist = pEncounterType->GetEncounterDesc().GetEnemyExclusionRadius();
63+
CVector vUR = pObj->GetPos() + CVector(dist, dist);
64+
CVector vLL = pObj->GetPos() - CVector(dist, dist);
6265

6366
// Only add obstacles if start and end are outside the obstacle
6467

@@ -68,8 +71,8 @@ int CNavigationPath::ComputePath (CSystem *pSystem, CSovereign *pSovereign, cons
6871
}
6972
else if (pObj->HasGravity())
7073
{
71-
CVector vUR = pObj->GetPos() + CVector(MAX_SAFE_DIST, MAX_SAFE_DIST);
72-
CVector vLL = pObj->GetPos() - CVector(MAX_SAFE_DIST, MAX_SAFE_DIST);
74+
CVector vUR = pObj->GetPos() + CVector(2*MAX_SAFE_DIST, 2*MAX_SAFE_DIST);
75+
CVector vLL = pObj->GetPos() - CVector(2*MAX_SAFE_DIST, 2*MAX_SAFE_DIST);
7376

7477
// Only add obstacles if start and end are outside the obstacle
7578

0 commit comments

Comments
 (0)