From 16410d09608ba3b41550b0eda2c2f6029dce068c Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 15 Mar 2024 23:52:55 +0100 Subject: [PATCH] Use std::string for ResourceManager cache key Otherwise terrain textures cache has zero hits because it stores not normalized paths. Due to implicit conversion it's possible to add entry with addEntryToObjectCache passing a string that is converted into normalized path. But then getRefFromObjectCache called with original value does not find this entry because it's not converted and overloaded operators are used instead. --- components/resource/niffilemanager.cpp | 2 +- components/resource/resourcemanager.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/resource/niffilemanager.cpp b/components/resource/niffilemanager.cpp index 0cc48d4247..c66c7de849 100644 --- a/components/resource/niffilemanager.cpp +++ b/components/resource/niffilemanager.cpp @@ -52,7 +52,7 @@ namespace Resource Nif::Reader reader(*file, mEncoder); reader.parse(mVFS->get(name)); obj = new NifFileHolder(file); - mCache->addEntryToObjectCache(name, obj); + mCache->addEntryToObjectCache(name.value(), obj); return file; } } diff --git a/components/resource/resourcemanager.hpp b/components/resource/resourcemanager.hpp index e2626665c8..63ec95de63 100644 --- a/components/resource/resourcemanager.hpp +++ b/components/resource/resourcemanager.hpp @@ -72,7 +72,7 @@ namespace Resource double mExpiryDelay; }; - class ResourceManager : public GenericResourceManager + class ResourceManager : public GenericResourceManager { public: explicit ResourceManager(const VFS::Manager* vfs, double expiryDelay)