diff --git a/components/detournavigator/gettilespositions.cpp b/components/detournavigator/gettilespositions.cpp index 4bf5159a88..7a179aff24 100644 --- a/components/detournavigator/gettilespositions.cpp +++ b/components/detournavigator/gettilespositions.cpp @@ -29,7 +29,7 @@ namespace DetourNavigator if (minTile.y() > maxTile.y()) std::swap(minTile.y(), maxTile.y()); - return {minTile, maxTile}; + return {minTile, maxTile + osg::Vec2i(1, 1)}; } TilesPositionsRange makeTilesPositionsRange(const btCollisionShape& shape, const btTransform& transform, diff --git a/components/detournavigator/gettilespositions.hpp b/components/detournavigator/gettilespositions.hpp index 8a8b2b7c32..db88708314 100644 --- a/components/detournavigator/gettilespositions.hpp +++ b/components/detournavigator/gettilespositions.hpp @@ -18,8 +18,8 @@ namespace DetourNavigator struct TilesPositionsRange { - TilePosition mMin; - TilePosition mMax; + TilePosition mBegin; + TilePosition mEnd; }; TilesPositionsRange makeTilesPositionsRange(const osg::Vec2f& aabbMin, @@ -32,10 +32,10 @@ namespace DetourNavigator const RecastSettings& settings); template - void getTilesPositions(const TilesPositionsRange& range, Callback&& callback) + inline void getTilesPositions(const TilesPositionsRange& range, Callback&& callback) { - for (int tileX = range.mMin.x(); tileX <= range.mMax.x(); ++tileX) - for (int tileY = range.mMin.y(); tileY <= range.mMax.y(); ++tileY) + for (int tileX = range.mBegin.x(); tileX < range.mEnd.x(); ++tileX) + for (int tileY = range.mBegin.y(); tileY < range.mEnd.y(); ++tileY) callback(TilePosition {tileX, tileY}); } }