1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-06 00:40:04 +00:00

Disable navmesh disk cache when db is failed to open

This commit is contained in:
elsid 2022-01-27 21:18:01 +01:00
parent 1b3acc85f7
commit 8b4362ece7
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

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