MCPcopy Create free account
hub / github.com/axmolengine/axmol / updateSlicedFindPath

Method updateSlicedFindPath

3rdparty/recast/DetourNavMeshQuery.cpp:1280–1495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1278}
1279
1280dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
1281{
1282 if (!dtStatusInProgress(m_query.status))
1283 return m_query.status;
1284
1285 // Make sure the request is still valid.
1286 if (!m_nav->isValidPolyRef(m_query.startRef) || !m_nav->isValidPolyRef(m_query.endRef))
1287 {
1288 m_query.status = DT_FAILURE;
1289 return DT_FAILURE;
1290 }
1291
1292 dtRaycastHit rayHit;
1293 rayHit.maxPath = 0;
1294
1295 int iter = 0;
1296 while (iter < maxIter && !m_openList->empty())
1297 {
1298 iter++;
1299
1300 // Remove node from open list and put it in closed list.
1301 dtNode* bestNode = m_openList->pop();
1302 bestNode->flags &= ~DT_NODE_OPEN;
1303 bestNode->flags |= DT_NODE_CLOSED;
1304
1305 // Reached the goal, stop searching.
1306 if (bestNode->id == m_query.endRef)
1307 {
1308 m_query.lastBestNode = bestNode;
1309 const dtStatus details = m_query.status & DT_STATUS_DETAIL_MASK;
1310 m_query.status = DT_SUCCESS | details;
1311 if (doneIters)
1312 *doneIters = iter;
1313 return m_query.status;
1314 }
1315
1316 // Get current poly and tile.
1317 // The API input has been cheked already, skip checking internal data.
1318 const dtPolyRef bestRef = bestNode->id;
1319 const dtMeshTile* bestTile = 0;
1320 const dtPoly* bestPoly = 0;
1321 if (dtStatusFailed(m_nav->getTileAndPolyByRef(bestRef, &bestTile, &bestPoly)))
1322 {
1323 // The polygon has disappeared during the sliced query, fail.
1324 m_query.status = DT_FAILURE;
1325 if (doneIters)
1326 *doneIters = iter;
1327 return m_query.status;
1328 }
1329
1330 // Get parent and grand parent poly and tile.
1331 dtPolyRef parentRef = 0, grandpaRef = 0;
1332 const dtMeshTile* parentTile = 0;
1333 const dtPoly* parentPoly = 0;
1334 dtNode* parentNode = 0;
1335 if (bestNode->pidx)
1336 {
1337 parentNode = m_nodePool->getNodeAtIdx(bestNode->pidx);

Callers 3

updateMoveRequestMethod · 0.80
updateMethod · 0.80
optimizePathTopologyMethod · 0.80

Calls 15

dtStatusInProgressFunction · 0.85
dtStatusFailedFunction · 0.85
dtVdistSqrFunction · 0.85
dtVdistFunction · 0.85
getTileAndPolyByRefMethod · 0.80
getNodeAtIdxMethod · 0.80
passFilterMethod · 0.80
getCostMethod · 0.80
getNodeIdxMethod · 0.80
modifyMethod · 0.80
isValidPolyRefMethod · 0.45

Tested by

no test coverage detected