Permalink
Browse files

Fix findPath to return DT_OUT_OF_NODES correctly (#222)

findPath was unconditionally overriding the status it used to indicate
DT_OUT_OF_NODES for later. Restore this behavior so it properly can
return this failure flag.

Fix #221
  • Loading branch information...
jakobbotsch committed Jul 27, 2016
1 parent 9052db4 commit 64385e9ed0822427bca5814d03a3f4c4d7a6db9f
Showing with 6 additions and 3 deletions.
  1. +6 −3 Detour/Source/DetourNavMeshQuery.cpp
@@ -1052,7 +1052,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef,
dtNode* lastBestNode = startNode;
float lastBestNodeCost = startNode->total;
dtStatus status = DT_SUCCESS;
bool outOfNodes = false;
while (!m_openList->empty())
{
@@ -1110,7 +1110,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef,
dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide);
if (!neighbourNode)
{
status |= DT_OUT_OF_NODES;
outOfNodes = true;
continue;
}
@@ -1190,10 +1190,13 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef,
}
}
status = getPathToNode(lastBestNode, path, pathCount, maxPath);
dtStatus status = getPathToNode(lastBestNode, path, pathCount, maxPath);
if (lastBestNode->id != endRef)
status |= DT_PARTIAL_RESULT;
if (outOfNodes)
status |= DT_OUT_OF_NODES;
return status;
}

0 comments on commit 64385e9

Please sign in to comment.