diff options
Diffstat (limited to 'dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp')
-rw-r--r-- | dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp b/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp index ec3a2946ea5..fbf3724e85b 100644 --- a/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp +++ b/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp @@ -16,13 +16,13 @@ // 3. This notice may not be removed or altered from any source distribution. // -#include <math.h> #include <float.h> #include <string.h> #include "DetourNavMeshQuery.h" #include "DetourNavMesh.h" #include "DetourNode.h" #include "DetourCommon.h" +#include "DetourMath.h" #include "DetourAlloc.h" #include "DetourAssert.h" #include <new> @@ -99,9 +99,9 @@ inline float dtQueryFilter::getCost(const float* pa, const float* pb, return dtVdist(pa, pb) * m_areaCost[curPoly->getArea()]; } #endif - + // Edited by TC -static const float H_SCALE = 2.0f; // Search heuristic scale. +static const float H_SCALE = 2.0f; // Search heuristic scale. dtNavMeshQuery* dtAllocNavMeshQuery() @@ -309,7 +309,7 @@ dtStatus dtNavMeshQuery::findRandomPoint(const dtQueryFilter* filter, float (*fr return DT_SUCCESS; } -dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const float* centerPos, const float radius, +dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const float* centerPos, const float maxRadius, const dtQueryFilter* filter, float (*frand)(), dtPolyRef* randomRef, float* randomPt) const { @@ -341,7 +341,7 @@ dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const f dtStatus status = DT_SUCCESS; - const float radiusSqr = dtSqr(radius); + const float radiusSqr = dtSqr(maxRadius); float areaSum = 0.0f; const dtMeshTile* randomTile = 0; @@ -705,7 +705,7 @@ dtStatus dtNavMeshQuery::getPolyHeight(dtPolyRef ref, const float* pos, float* h /// @p nearestRef before using @p nearestPt. /// /// @warning This function is not suitable for large area searches. If the search -/// extents overlaps more than 128 polygons it may return an invalid result. +/// extents overlaps more than MAX_SEARCH (128) polygons it may return an invalid result. /// dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* extents, const dtQueryFilter* filter, @@ -716,9 +716,10 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* exten *nearestRef = 0; // Get nearby polygons from proximity grid. - dtPolyRef polys[128]; + const int MAX_SEARCH = 128; + dtPolyRef polys[MAX_SEARCH]; int polyCount = 0; - if (dtStatusFailed(queryPolygons(center, extents, filter, polys, &polyCount, 128))) + if (dtStatusFailed(queryPolygons(center, extents, filter, polys, &polyCount, MAX_SEARCH))) return DT_FAILURE | DT_INVALID_PARAM; // Find nearest polygon amongst the nearby polygons. @@ -1304,12 +1305,8 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters) if (!m_query.filter->passFilter(neighbourRef, neighbourTile, neighbourPoly)) continue; - // deal explicitly with crossing tile boundaries - unsigned char crossSide = 0; - if (bestTile->links[i].side != 0xff) - crossSide = bestTile->links[i].side >> 1; - - dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide); + // get the neighbor node + dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, 0); if (!neighbourNode) { m_query.status |= DT_OUT_OF_NODES; |