1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 13:39:40 +00:00

Use default objects for NavigatorStub methods result

This commit is contained in:
elsid 2019-02-19 11:46:00 +03:00
parent ece111d05a
commit 8d2af94b75
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
4 changed files with 12 additions and 7 deletions

View file

@ -191,7 +191,7 @@ namespace DetourNavigator
*/ */
virtual std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const = 0; virtual std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const = 0;
virtual Settings getSettings() const = 0; virtual const Settings& getSettings() const = 0;
}; };
} }

View file

@ -133,7 +133,7 @@ namespace DetourNavigator
return mNavMeshManager.getNavMeshes(); return mNavMeshManager.getNavMeshes();
} }
Settings NavigatorImpl::getSettings() const const Settings& NavigatorImpl::getSettings() const
{ {
return mSettings; return mSettings;
} }

View file

@ -46,7 +46,7 @@ namespace DetourNavigator
std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const override; std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const override;
Settings getSettings() const override; const Settings& getSettings() const override;
private: private:
Settings mSettings; Settings mSettings;

View file

@ -5,8 +5,9 @@
namespace DetourNavigator namespace DetourNavigator
{ {
struct NavigatorStub final : public Navigator class NavigatorStub final : public Navigator
{ {
public:
NavigatorStub() = default; NavigatorStub() = default;
void addAgent(const osg::Vec3f& /*agentHalfExtents*/) override {} void addAgent(const osg::Vec3f& /*agentHalfExtents*/) override {}
@ -65,7 +66,7 @@ namespace DetourNavigator
SharedNavMeshCacheItem getNavMesh(const osg::Vec3f& /*agentHalfExtents*/) const override SharedNavMeshCacheItem getNavMesh(const osg::Vec3f& /*agentHalfExtents*/) const override
{ {
return SharedNavMeshCacheItem(); return mEmptyNavMeshCacheItem;
} }
std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const override std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const override
@ -73,10 +74,14 @@ namespace DetourNavigator
return std::map<osg::Vec3f, SharedNavMeshCacheItem>(); return std::map<osg::Vec3f, SharedNavMeshCacheItem>();
} }
Settings getSettings() const override const Settings& getSettings() const override
{ {
return Settings {}; return mDefaultSettings;
} }
private:
Settings mDefaultSettings {};
SharedNavMeshCacheItem mEmptyNavMeshCacheItem;
}; };
} }