Use default objects for NavigatorStub methods result

pull/541/head
elsid 6 years ago
parent ece111d05a
commit 8d2af94b75
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

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

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

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

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

Loading…
Cancel
Save