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
This commit is contained in:
parent
9052db45d8
commit
64385e9ed0
@ -1052,7 +1052,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef,
|
|||||||
dtNode* lastBestNode = startNode;
|
dtNode* lastBestNode = startNode;
|
||||||
float lastBestNodeCost = startNode->total;
|
float lastBestNodeCost = startNode->total;
|
||||||
|
|
||||||
dtStatus status = DT_SUCCESS;
|
bool outOfNodes = false;
|
||||||
|
|
||||||
while (!m_openList->empty())
|
while (!m_openList->empty())
|
||||||
{
|
{
|
||||||
@ -1110,7 +1110,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef,
|
|||||||
dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide);
|
dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide);
|
||||||
if (!neighbourNode)
|
if (!neighbourNode)
|
||||||
{
|
{
|
||||||
status |= DT_OUT_OF_NODES;
|
outOfNodes = true;
|
||||||
continue;
|
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)
|
if (lastBestNode->id != endRef)
|
||||||
status |= DT_PARTIAL_RESULT;
|
status |= DT_PARTIAL_RESULT;
|
||||||
|
|
||||||
|
if (outOfNodes)
|
||||||
|
status |= DT_OUT_OF_NODES;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user