1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +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 Settings getSettings() const = 0;
virtual const Settings& getSettings() const = 0;
};
}

View file

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

View file

@ -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;

View file

@ -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;
};
}