Set up ESMReader indices in OpenCS (fixes wrong terrain textures when multiple content files are loaded)

This commit is contained in:
scrawl 2014-11-18 11:47:46 +01:00
parent 21481e8c71
commit 3028141815
2 changed files with 3 additions and 1 deletions

View file

@ -60,7 +60,7 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager)
: mEncoder (encoding), mPathgrids (mCells), mRefs (mCells),
mResourcesManager (resourcesManager), mReader (0), mDialogue (0)
mResourcesManager (resourcesManager), mReader (0), mDialogue (0), mReaderIndex(0)
{
mGlobals.addColumn (new StringIdColumn<ESM::Global>);
mGlobals.addColumn (new RecordStateColumn<ESM::Global>);
@ -659,6 +659,7 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base
mReader = new ESM::ESMReader;
mReader->setEncoder (&mEncoder);
mReader->setIndex(mReaderIndex++);
mReader->open (path.string());
mBase = base;

View file

@ -98,6 +98,7 @@ namespace CSMWorld
bool mBase;
bool mProject;
std::map<std::string, std::map<ESM::RefNum, std::string> > mRefLoadCache;
int mReaderIndex;
std::vector<boost::shared_ptr<ESM::ESMReader> > mReaders;