Update dtNavMeshQuery structure

Member 'filter' has been moved out of 'dtNavMeshQuery::dtQueryData'. New offset = 0x60 (after m_openList). Renamed to 'm_queryFilter' to maintain consistency.
This commit is contained in:
Kawe Mazidjatari 2022-07-20 01:33:09 +02:00
parent 59dd3e2228
commit c0d3dafa6f
2 changed files with 8 additions and 8 deletions

View File

@ -565,7 +565,6 @@ private:
float lastBestNodeCost;
dtPolyRef startRef, endRef;
float startPos[3], endPos[3];
const dtQueryFilter* filter;
unsigned int options;
float raycastLimitSqr;
};
@ -574,6 +573,7 @@ private:
class dtNodePool* m_tinyNodePool; ///< Pointer to small node pool.
class dtNodePool* m_nodePool; ///< Pointer to node pool.
class dtNodeQueue* m_openList; ///< Pointer to open list queue.
const dtQueryFilter* m_queryFilter; ///< Pointer to query filter.
};
/// Allocates a query object using the Detour allocator.

View File

@ -1219,7 +1219,7 @@ dtStatus dtNavMeshQuery::initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef
dtVcopy(m_query.startPos, startPos);
if (endPos)
dtVcopy(m_query.endPos, endPos);
m_query.filter = filter;
m_queryFilter = filter;
m_query.options = options;
m_query.raycastLimitSqr = FLT_MAX;
@ -1363,7 +1363,7 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
const dtPoly* neighbourPoly = 0;
m_nav->getTileAndPolyByRefUnsafe(neighbourRef, &neighbourTile, &neighbourPoly);
if (!m_query.filter->passFilter(neighbourRef, neighbourTile, neighbourPoly))
if (!m_queryFilter->passFilter(neighbourRef, neighbourTile, neighbourPoly))
continue;
// get the neighbor node
@ -1395,7 +1395,7 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
rayHit.pathCost = rayHit.t = 0;
if (tryLOS)
{
raycast(parentRef, parentNode->pos, neighbourNode->pos, m_query.filter, DT_RAYCAST_USE_COSTS, &rayHit, grandpaRef);
raycast(parentRef, parentNode->pos, neighbourNode->pos, m_queryFilter, DT_RAYCAST_USE_COSTS, &rayHit, grandpaRef);
foundShortCut = rayHit.t >= 1.0f;
}
@ -1408,7 +1408,7 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
else
{
// No shortcut found.
const float curCost = m_query.filter->getCost(bestNode->pos, neighbourNode->pos,
const float curCost = m_queryFilter->getCost(bestNode->pos, neighbourNode->pos,
parentRef, parentTile, parentPoly,
bestRef, bestTile, bestPoly,
neighbourRef, neighbourTile, neighbourPoly);
@ -1418,7 +1418,7 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
// Special case for last node.
if (neighbourRef == m_query.endRef)
{
const float endCost = m_query.filter->getCost(neighbourNode->pos, m_query.endPos,
const float endCost = m_queryFilter->getCost(neighbourNode->pos, m_query.endPos,
bestRef, bestTile, bestPoly,
neighbourRef, neighbourTile, neighbourPoly,
0, 0, 0);
@ -1540,7 +1540,7 @@ dtStatus dtNavMeshQuery::finalizeSlicedFindPath(dtPolyRef* path, int* pathCount,
{
float t, normal[3];
int m;
status = raycast(node->id, node->pos, next->pos, m_query.filter, &t, normal, path+n, &m, maxPath-n);
status = raycast(node->id, node->pos, next->pos, m_queryFilter, &t, normal, path+n, &m, maxPath-n);
n += m;
// raycast ends on poly boundary and the path might include the next poly boundary.
if (path[n-1] == next->id)
@ -1641,7 +1641,7 @@ dtStatus dtNavMeshQuery::finalizeSlicedFindPathPartial(const dtPolyRef* existing
{
float t, normal[3];
int m;
status = raycast(node->id, node->pos, next->pos, m_query.filter, &t, normal, path+n, &m, maxPath-n);
status = raycast(node->id, node->pos, next->pos, m_queryFilter, &t, normal, path+n, &m, maxPath-n);
n += m;
// raycast ends on poly boundary and the path might include the next poly boundary.
if (path[n-1] == next->id)