diff --git a/Detour/Include/DetourNavMesh.h b/Detour/Include/DetourNavMesh.h index 1060845..583d2ff 100644 --- a/Detour/Include/DetourNavMesh.h +++ b/Detour/Include/DetourNavMesh.h @@ -620,7 +620,7 @@ private: void connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int side); /// Removes external links at specified side. - void unconnectExtLinks(dtMeshTile* tile, dtMeshTile* target); + void unconnectLinks(dtMeshTile* tile, dtMeshTile* target); // TODO: These methods are duplicates from dtNavMeshQuery, but are needed for off-mesh connection finding. diff --git a/Detour/Source/DetourNavMesh.cpp b/Detour/Source/DetourNavMesh.cpp index d353d08..b5c40a9 100644 --- a/Detour/Source/DetourNavMesh.cpp +++ b/Detour/Source/DetourNavMesh.cpp @@ -350,7 +350,7 @@ int dtNavMesh::findConnectingPolys(const float* va, const float* vb, return n; } -void dtNavMesh::unconnectExtLinks(dtMeshTile* tile, dtMeshTile* target) +void dtNavMesh::unconnectLinks(dtMeshTile* tile, dtMeshTile* target) { if (!tile || !target) return; @@ -363,10 +363,9 @@ void dtNavMesh::unconnectExtLinks(dtMeshTile* tile, dtMeshTile* target) unsigned int pj = DT_NULL_LINK; while (j != DT_NULL_LINK) { - if (tile->links[j].side != 0xff && - decodePolyIdTile(tile->links[j].ref) == targetNum) + if (decodePolyIdTile(tile->links[j].ref) == targetNum) { - // Revove link. + // Remove link. unsigned int nj = tile->links[j].next; if (pj == DT_NULL_LINK) poly->firstLink = nj; @@ -1192,25 +1191,24 @@ dtStatus dtNavMesh::removeTile(dtTileRef ref, unsigned char** data, int* dataSiz } // Remove connections to neighbour tiles. - // Create connections with neighbour tiles. static const int MAX_NEIS = 32; dtMeshTile* neis[MAX_NEIS]; int nneis; - // Connect with layers in current tile. + // Disconnect from other layers in current tile. nneis = getTilesAt(tile->header->x, tile->header->y, neis, MAX_NEIS); for (int j = 0; j < nneis; ++j) { if (neis[j] == tile) continue; - unconnectExtLinks(neis[j], tile); + unconnectLinks(neis[j], tile); } - // Connect with neighbour tiles. + // Disconnect from neighbour tiles. for (int i = 0; i < 8; ++i) { nneis = getNeighbourTilesAt(tile->header->x, tile->header->y, i, neis, MAX_NEIS); for (int j = 0; j < nneis; ++j) - unconnectExtLinks(neis[j], tile); + unconnectLinks(neis[j], tile); } // Reset tile.