mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +00:00
5b9dd10cbe
Use "pragma max_page_count" to define max allowed file size in combination with "pragma page_size" based on a new setting "max navmeshdb file size". * Stop navmeshtool on the first db error. * Disable writes to db in the engine on first "database or disk is full" SQLite3 error. There is no special error code for this error. * Change default "write to navmeshdb" to true. * Use time intervals for transaction duration instead of number of changes.
35 lines
978 B
C++
35 lines
978 B
C++
#include "navigator.hpp"
|
|
#include "navigatorimpl.hpp"
|
|
#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)
|
|
{
|
|
DetourNavigator::RecastGlobalAllocator::init();
|
|
|
|
std::unique_ptr<NavMeshDb> db;
|
|
if (settings.mEnableNavMeshDiskCache)
|
|
{
|
|
try
|
|
{
|
|
db = std::make_unique<NavMeshDb>(userDataPath + "/navmesh.db", settings.mMaxDbFileSize);
|
|
}
|
|
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));
|
|
}
|
|
|
|
std::unique_ptr<Navigator> makeNavigatorStub()
|
|
{
|
|
return std::make_unique<NavigatorStub>();
|
|
}
|
|
}
|