From 4cf5ab4d7b8d2a1905d28d1c482b9c1b592edc83 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Fri, 24 Sep 2010 06:15:01 +0000 Subject: [PATCH] Fix for issue 125. --- Detour/Source/DetourNavMesh.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Detour/Source/DetourNavMesh.cpp b/Detour/Source/DetourNavMesh.cpp index ab805d3..f685071 100644 --- a/Detour/Source/DetourNavMesh.cpp +++ b/Detour/Source/DetourNavMesh.cpp @@ -869,6 +869,20 @@ dtTileRef dtNavMesh::getTileRefAt(int x, int y) const return 0; } +const dtMeshTile* dtNavMesh::getTileByRef(dtTileRef ref) const +{ + if (!ref) + return 0; + unsigned int tileIndex = decodePolyIdTile((dtPolyRef)ref); + unsigned int tileSalt = decodePolyIdSalt((dtPolyRef)ref); + if ((int)tileIndex >= m_maxTiles) + return 0; + const dtMeshTile* tile = &m_tiles[tileIndex]; + if (tile->salt != tileSalt) + return 0; + return tile; +} + int dtNavMesh::getMaxTiles() const { return m_maxTiles;