Skip to content

Commit 72c5fd5

Browse files
authored
Merge 39d2cf7 into 9f0bece
2 parents 9f0bece + 39d2cf7 commit 72c5fd5

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/game/MotionGenerators/PathFinder.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
254254
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: farFromPoly distToStartPoly=%.3f distToEndPoly=%.3f for %s\n",
255255
distToStartPoly, distToEndPoly, m_sourceUnit->GetGuidStr().c_str());
256256

257-
bool buildShotrcut = false;
257+
bool buildShortcut = false;
258258
if (m_sourceUnit->GetTypeId() == TYPEID_UNIT)
259259
{
260260
const Creature* owner = m_sourceUnit->ToCreature();
@@ -265,20 +265,20 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
265265
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: underWater case for %s\n", m_sourceUnit->GetGuidStr().c_str());
266266
if (owner->CanSwim())
267267
{
268-
buildShotrcut = true;
268+
buildShortcut = true;
269269
}
270270
}
271271
else
272272
{
273273
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: flying case for %s\n", m_sourceUnit->GetGuidStr().c_str());
274274
if (owner->CanFly())
275275
{
276-
buildShotrcut = true;
276+
buildShortcut = true;
277277
}
278278
}
279279
}
280280

281-
if (buildShotrcut)
281+
if (buildShortcut)
282282
{
283283
BuildShortcut();
284284
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
@@ -461,6 +461,21 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
461461
{
462462
m_type = PATHFIND_NORMAL;
463463
}
464+
else // case for playerbots navigating polyless gaps in water nav
465+
if (m_sourceUnit->GetMap()->GetTerrain()->IsInWater(startPos.x, startPos.y, startPos.z) &&
466+
dtVdist(startPoint, endPoint) < 25.0f &&
467+
m_sourceUnit->GetTypeId() == TYPEID_PLAYER &&
468+
m_sourceUnit->GetMap()->IsInLineOfSight(startPos.x, startPos.y, startPos.z + 2.0f, endPos.x, endPos.y, endPos.z + 2.0f))
469+
470+
{
471+
Player* player = (Player*)m_sourceUnit;
472+
if (player->GetPlayerbotAI())
473+
{
474+
BuildShortcut();
475+
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
476+
return;
477+
}
478+
}
464479
else
465480
{
466481
m_type = PATHFIND_INCOMPLETE;

0 commit comments

Comments
 (0)