MAX_SEARCH constant instead of hardcoded value

This commit is contained in:
Kromster80 2015-01-06 23:26:14 +03:00
parent ce304d195f
commit 5c45736347

View File

@ -704,7 +704,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,
@ -715,9 +715,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.