1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-29 17:06:43 +00:00

Make Navigator::findPath independent from class fields

This commit is contained in:
elsid 2019-02-16 15:14:05 +03:00
parent a0ed981a7c
commit d63881e054
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
2 changed files with 18 additions and 6 deletions

View file

@ -122,12 +122,17 @@ namespace DetourNavigator
mNavMeshManager.wait(); mNavMeshManager.wait();
} }
SharedNavMeshCacheItem Navigator::getNavMesh(const osg::Vec3f& agentHalfExtents) const
{
return mNavMeshManager.getNavMesh(agentHalfExtents);
}
std::map<osg::Vec3f, SharedNavMeshCacheItem> Navigator::getNavMeshes() const std::map<osg::Vec3f, SharedNavMeshCacheItem> Navigator::getNavMeshes() const
{ {
return mNavMeshManager.getNavMeshes(); return mNavMeshManager.getNavMeshes();
} }
const Settings& Navigator::getSettings() const Settings Navigator::getSettings() const
{ {
return mSettings; return mSettings;
} }

View file

@ -175,19 +175,26 @@ namespace DetourNavigator
>::value, >::value,
"out is not an OutputIterator" "out is not an OutputIterator"
); );
const auto navMesh = mNavMeshManager.getNavMesh(agentHalfExtents); const auto navMesh = getNavMesh(agentHalfExtents);
return findSmoothPath(navMesh.lock()->getValue(), toNavMeshCoordinates(mSettings, agentHalfExtents), const auto settings = getSettings();
toNavMeshCoordinates(mSettings, start), toNavMeshCoordinates(mSettings, end), includeFlags, return findSmoothPath(navMesh.lock()->getValue(), toNavMeshCoordinates(settings, agentHalfExtents),
mSettings, out); toNavMeshCoordinates(settings, start), toNavMeshCoordinates(settings, end), includeFlags,
settings, out);
} }
/**
* @brief getNavMesh returns navmesh for specific agent half extents
* @return navmesh
*/
SharedNavMeshCacheItem getNavMesh(const osg::Vec3f& agentHalfExtents) const;
/** /**
* @brief getNavMeshes returns all current navmeshes * @brief getNavMeshes returns all current navmeshes
* @return map of agent half extents to navmesh * @return map of agent half extents to navmesh
*/ */
std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const; std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const;
const Settings& getSettings() const; Settings getSettings() const;
private: private:
Settings mSettings; Settings mSettings;