mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/MMaps: Fix infinite loop in Detour
Fix another infinite loop in Detour caused by degenerated triangles. Check the result of some previously ignored Detour calls. Update recastnavigation to 3a619d773deb7e3a15ee215217c825995fe71312 and apply some more custom changes
This commit is contained in:
@@ -62,4 +62,5 @@ gSOAP (a portable development toolkit for C and C++ XML Web services and XML dat
|
||||
|
||||
recastnavigation (Recast is state of the art navigation mesh construction toolset for games)
|
||||
https://github.com/recastnavigation/recastnavigation
|
||||
Version: 14b2631527c4792e95b2c78ebfa8ac4cd3413363
|
||||
Version: 3a619d773deb7e3a15ee215217c825995fe71312
|
||||
Custom changes: https://github.com/TrinityCore/recastnavigation/tree/3.3.5
|
||||
|
||||
@@ -226,7 +226,15 @@ bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b
|
||||
|
||||
// If point lies inside the triangle, return interpolated ycoord.
|
||||
if (u >= epsilon && v >= epsilon && (u+v) <= denom - epsilon) {
|
||||
h = a[1] + (v0[1]*u + v1[1]*v) / denom;
|
||||
|
||||
if (denom == 0.f && u == 0.f && v == 0.f)
|
||||
h = a[1];
|
||||
else
|
||||
h = a[1] + (v0[1]*u + v1[1]*v) / denom;
|
||||
|
||||
if (!dtMathIsfinite(h))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1301,8 +1301,8 @@ dtStatus dtNavMeshQuery::initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef
|
||||
m_query.raycastLimitSqr = FLT_MAX;
|
||||
|
||||
// Validate input
|
||||
if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef)
|
||||
|| !startPos || !dtVisfinite(startPos) ||
|
||||
if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) ||
|
||||
!startPos || !dtVisfinite(startPos) ||
|
||||
!endPos || !dtVisfinite(endPos) || !filter)
|
||||
{
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
|
||||
@@ -817,10 +817,12 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
|
||||
dtPolyRef visited[MAX_VISIT_POLY];
|
||||
|
||||
uint32 nvisited = 0;
|
||||
_navMeshQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &_filter, result, visited, (int*)&nvisited, MAX_VISIT_POLY);
|
||||
if (dtStatusFailed(_navMeshQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &_filter, result, visited, (int*)&nvisited, MAX_VISIT_POLY)))
|
||||
return DT_FAILURE;
|
||||
npolys = FixupCorridor(polys, npolys, MAX_PATH_LENGTH, visited, nvisited);
|
||||
|
||||
_navMeshQuery->getPolyHeight(polys[0], result, &result[1]);
|
||||
if (dtStatusFailed(_navMeshQuery->getPolyHeight(polys[0], result, &result[1])))
|
||||
return DT_FAILURE;
|
||||
result[1] += 0.5f;
|
||||
dtVcopy(iterPos, result);
|
||||
|
||||
@@ -865,7 +867,8 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
|
||||
}
|
||||
// Move position at the other side of the off-mesh link.
|
||||
dtVcopy(iterPos, connectionEndPos);
|
||||
_navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1]);
|
||||
if (dtStatusFailed(_navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1])))
|
||||
return DT_FAILURE;
|
||||
iterPos[1] += 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user