1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 18:32:36 +00:00

Merge branch 'navmesh_db_fallback' into 'master'

Disable navmesh disk cache when db is failed to open

See merge request OpenMW/openmw!1672
This commit is contained in:
psi29a 2022-02-19 12:08:27 +00:00
commit f674c4ac73

View File

@ -3,6 +3,8 @@
#include "navigatorstub.hpp"
#include "recastglobalallocator.hpp"
#include <components/debug/debuglog.hpp>
namespace DetourNavigator
{
std::unique_ptr<Navigator> makeNavigator(const Settings& settings, const std::string& userDataPath)
@ -11,7 +13,16 @@ namespace DetourNavigator
std::unique_ptr<NavMeshDb> db;
if (settings.mEnableNavMeshDiskCache)
db = std::make_unique<NavMeshDb>(userDataPath + "/navmesh.db");
{
try
{
db = std::make_unique<NavMeshDb>(userDataPath + "/navmesh.db");
}
catch (const std::exception& e)
{
Log(Debug::Error) << e.what() << ", navigation mesh disk cache will be disabled";
}
}
return std::make_unique<NavigatorImpl>(settings, std::move(db));
}