1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 21:39:48 +00:00

Initialize expiry delay for all GenericResourceManager instances

This commit is contained in:
elsid 2023-08-27 17:12:42 +02:00
parent 6d120f92e0
commit 52ab47771c
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
3 changed files with 14 additions and 7 deletions

View file

@ -834,9 +834,6 @@ namespace MWWorld
mPreloader = std::make_unique<CellPreloader>(rendering.getResourceSystem(), physics->getShapeManager(),
rendering.getTerrain(), rendering.getLandManager());
mPreloader->setWorkQueue(mRendering.getWorkQueue());
rendering.getResourceSystem()->setExpiryDelay(Settings::cells().mCacheExpiryDelay);
mPreloader->setExpiryDelay(Settings::cells().mPreloadCellExpiryDelay);
mPreloader->setMinCacheSize(Settings::cells().mPreloadCellCacheMin);
mPreloader->setMaxCacheSize(Settings::cells().mPreloadCellCacheMax);

View file

@ -32,7 +32,9 @@ namespace Resource
};
NifFileManager::NifFileManager(const VFS::Manager* vfs)
: ResourceManager(vfs)
// NIF files aren't needed any more once the converted objects are cached in SceneManager / BulletShapeManager,
// so no point in using an expiry delay.
: ResourceManager(vfs, 0)
{
}

View file

@ -3,6 +3,8 @@
#include <osg/ref_ptr>
#include <components/settings/values.hpp>
#include "objectcache.hpp"
namespace VFS
@ -39,10 +41,11 @@ namespace Resource
public:
typedef GenericObjectCache<KeyType> CacheType;
GenericResourceManager(const VFS::Manager* vfs)
explicit GenericResourceManager(
const VFS::Manager* vfs, double expiryDelay = Settings::cells().mCacheExpiryDelay)
: mVFS(vfs)
, mCache(new CacheType)
, mExpiryDelay(0.0)
, mExpiryDelay(expiryDelay)
{
}
@ -77,10 +80,15 @@ namespace Resource
class ResourceManager : public GenericResourceManager<std::string>
{
public:
ResourceManager(const VFS::Manager* vfs)
explicit ResourceManager(const VFS::Manager* vfs)
: GenericResourceManager<std::string>(vfs)
{
}
explicit ResourceManager(const VFS::Manager* vfs, double expiryDelay)
: GenericResourceManager<std::string>(vfs, expiryDelay)
{
}
};
}