mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:53:52 +00:00
Merge branch 'cleanup_esm3_readers_cache' into 'master'
Remove stateless encoder from ReadersCache See merge request OpenMW/openmw!3823
This commit is contained in:
commit
c9489bad9b
3 changed files with 7 additions and 20 deletions
|
@ -64,11 +64,12 @@ namespace MWWorld
|
|||
}
|
||||
case ESM::Format::Tes4:
|
||||
{
|
||||
ESM4::Reader readerESM4(std::move(stream), filepath,
|
||||
MWBase::Environment::get().getResourceSystem()->getVFS(), mReaders.getStatelessEncoder());
|
||||
readerESM4.setModIndex(index);
|
||||
readerESM4.updateModIndices(mNameToIndex);
|
||||
mStore.loadESM4(readerESM4);
|
||||
ESM4::Reader reader(std::move(stream), filepath,
|
||||
MWBase::Environment::get().getResourceSystem()->getVFS(),
|
||||
mEncoder != nullptr ? &mEncoder->getStatelessEncoder() : nullptr);
|
||||
reader.setModIndex(index);
|
||||
reader.updateModIndices(mNameToIndex);
|
||||
mStore.loadESM4(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,8 +274,6 @@ namespace MWWorld
|
|||
const std::vector<std::string>& groundcoverFiles, ToUTF8::Utf8Encoder* encoder, Loading::Listener* listener)
|
||||
{
|
||||
mContentFiles = contentFiles;
|
||||
if (encoder)
|
||||
mReaders.setStatelessEncoder(encoder->getStatelessEncoder());
|
||||
mESMVersions.resize(mContentFiles.size(), -1);
|
||||
|
||||
loadContentFiles(fileCollections, contentFiles, encoder, listener);
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include <components/to_utf8/to_utf8.hpp>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ReadersCache
|
||||
|
@ -57,23 +55,13 @@ namespace ESM
|
|||
|
||||
BusyItem get(std::size_t index);
|
||||
|
||||
void setStatelessEncoder(const ToUTF8::StatelessUtf8Encoder& statelessEncoderPtr)
|
||||
{
|
||||
mStatelessEncoder.emplace(statelessEncoderPtr);
|
||||
}
|
||||
|
||||
const ToUTF8::StatelessUtf8Encoder* getStatelessEncoder()
|
||||
{
|
||||
return mStatelessEncoder.has_value() ? &mStatelessEncoder.value() : nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
const std::size_t mCapacity;
|
||||
std::map<std::size_t, std::list<Item>::iterator> mIndex;
|
||||
std::list<Item> mBusyItems;
|
||||
std::list<Item> mFreeItems;
|
||||
std::list<Item> mClosedItems;
|
||||
std::optional<ToUTF8::StatelessUtf8Encoder> mStatelessEncoder;
|
||||
|
||||
inline void closeExtraReaders();
|
||||
|
||||
inline void releaseItem(std::list<Item>::iterator it) noexcept;
|
||||
|
|
Loading…
Reference in a new issue