diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 268d6a3c28..b366666231 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -47,6 +47,7 @@ #include #include +#include #include "mwinput/inputmanagerimp.hpp" @@ -670,10 +671,7 @@ void OMW::Engine::prepareEngine() Settings::Manager::getString("texture mipmap", "General"), Settings::Manager::getInt("anisotropy", "General")); mEnvironment.setResourceSystem(*mResourceSystem); - int numThreads = Settings::Manager::getInt("preload num threads", "Cells"); - if (numThreads <= 0) - throw std::runtime_error("Invalid setting: 'preload num threads' must be >0"); - mWorkQueue = new SceneUtil::WorkQueue(numThreads); + mWorkQueue = new SceneUtil::WorkQueue(Settings::cells().mPreloadNumThreads); mUnrefQueue = std::make_unique(); mScreenCaptureOperation = new SceneUtil::AsyncScreenCaptureOperation(mWorkQueue, diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index b114ed92bc..780f9ad0b9 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -440,8 +440,7 @@ namespace MWRender if (getenv("OPENMW_DONT_PRECOMPILE") == nullptr) { mViewer->setIncrementalCompileOperation(new osgUtil::IncrementalCompileOperation); - mViewer->getIncrementalCompileOperation()->setTargetFrameRate( - Settings::Manager::getFloat("target framerate", "Cells")); + mViewer->getIncrementalCompileOperation()->setTargetFrameRate(Settings::cells().mTargetFramerate); } mDebugDraw @@ -486,7 +485,7 @@ namespace MWRender mTerrain = std::make_unique(sceneRoot, mRootNode, mResourceSystem, mTerrainStorage.get(), Mask_Terrain, Mask_PreCompile, Mask_Debug); - mTerrain->setTargetFrameRate(Settings::Manager::getFloat("target framerate", "Cells")); + mTerrain->setTargetFrameRate(Settings::cells().mTargetFramerate); if (groundcover) { diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 7e3a00df07..b116fbe633 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "../mwbase/environment.hpp" #include "../mwbase/luamanager.hpp" @@ -718,7 +718,7 @@ namespace MWWorld mRendering.getResourceSystem()->getSceneManager()->setIncrementalCompileOperation( mRendering.getIncrementalCompileOperation()); - mRendering.getResourceSystem()->setExpiryDelay(Settings::Manager::getFloat("cache expiry delay", "Cells")); + mRendering.getResourceSystem()->setExpiryDelay(Settings::cells().mCacheExpiryDelay); } void Scene::testInteriorCells() @@ -776,7 +776,7 @@ namespace MWWorld mRendering.getResourceSystem()->getSceneManager()->setIncrementalCompileOperation( mRendering.getIncrementalCompileOperation()); - mRendering.getResourceSystem()->setExpiryDelay(Settings::Manager::getFloat("cache expiry delay", "Cells")); + mRendering.getResourceSystem()->setExpiryDelay(Settings::cells().mCacheExpiryDelay); } void Scene::changePlayerCell(CellStore& cell, const ESM::Position& pos, bool adjustPlayerPos) @@ -824,23 +824,23 @@ namespace MWWorld , mRendering(rendering) , mNavigator(navigator) , mCellLoadingThreshold(1024.f) - , mPreloadDistance(Settings::Manager::getInt("preload distance", "Cells")) - , mPreloadEnabled(Settings::Manager::getBool("preload enabled", "Cells")) - , mPreloadExteriorGrid(Settings::Manager::getBool("preload exterior grid", "Cells")) - , mPreloadDoors(Settings::Manager::getBool("preload doors", "Cells")) - , mPreloadFastTravel(Settings::Manager::getBool("preload fast travel", "Cells")) - , mPredictionTime(Settings::Manager::getFloat("prediction time", "Cells")) + , mPreloadDistance(Settings::cells().mPreloadDistance) + , mPreloadEnabled(Settings::cells().mPreloadEnabled) + , mPreloadExteriorGrid(Settings::cells().mPreloadExteriorGrid) + , mPreloadDoors(Settings::cells().mPreloadDoors) + , mPreloadFastTravel(Settings::cells().mPreloadFastTravel) + , mPredictionTime(Settings::cells().mPredictionTime) { mPreloader = std::make_unique(rendering.getResourceSystem(), physics->getShapeManager(), rendering.getTerrain(), rendering.getLandManager()); mPreloader->setWorkQueue(mRendering.getWorkQueue()); - rendering.getResourceSystem()->setExpiryDelay(Settings::Manager::getFloat("cache expiry delay", "Cells")); + rendering.getResourceSystem()->setExpiryDelay(Settings::cells().mCacheExpiryDelay); - mPreloader->setExpiryDelay(Settings::Manager::getFloat("preload cell expiry delay", "Cells")); - mPreloader->setMinCacheSize(Settings::Manager::getInt("preload cell cache min", "Cells")); - mPreloader->setMaxCacheSize(Settings::Manager::getInt("preload cell cache max", "Cells")); - mPreloader->setPreloadInstances(Settings::Manager::getBool("preload instances", "Cells")); + mPreloader->setExpiryDelay(Settings::cells().mPreloadCellExpiryDelay); + mPreloader->setMinCacheSize(Settings::cells().mPreloadCellCacheMin); + mPreloader->setMaxCacheSize(Settings::cells().mPreloadCellCacheMax); + mPreloader->setPreloadInstances(Settings::cells().mPreloadInstances); } Scene::~Scene() diff --git a/apps/openmw/mwworld/worldmodel.cpp b/apps/openmw/mwworld/worldmodel.cpp index 4f53dd329c..a4299dc4ca 100644 --- a/apps/openmw/mwworld/worldmodel.cpp +++ b/apps/openmw/mwworld/worldmodel.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -155,8 +155,7 @@ void MWWorld::WorldModel::writeCell(ESM::ESMWriter& writer, CellStore& cell) con MWWorld::WorldModel::WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& readers) : mStore(store) , mReaders(readers) - , mIdCache( - std::clamp(Settings::Manager::getInt("pointers cache size", "Cells"), 40, 1000), { ESM::RefId(), nullptr }) + , mIdCache(Settings::cells().mPointersCacheSize, { ESM::RefId(), nullptr }) { }