From 3028141815cedba10462f4e54bbe2da79f26e50b Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 18 Nov 2014 11:47:46 +0100 Subject: [PATCH] Set up ESMReader indices in OpenCS (fixes wrong terrain textures when multiple content files are loaded) --- apps/opencs/model/world/data.cpp | 3 ++- apps/opencs/model/world/data.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index c11594207..9cb0299c4 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -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); mGlobals.addColumn (new RecordStateColumn); @@ -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; diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index 70a02656b..37d4d4b8a 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -98,6 +98,7 @@ namespace CSMWorld bool mBase; bool mProject; std::map > mRefLoadCache; + int mReaderIndex; std::vector > mReaders;