|
|
|
@ -64,7 +64,7 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
|
|
|
|
|
CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir)
|
|
|
|
|
: mEncoder (encoding), mPathgrids (mCells), mRefs (mCells),
|
|
|
|
|
mResourcesManager (resourcesManager), mFallbackMap(fallback),
|
|
|
|
|
mReader (0), mDialogue (0), mReaderIndex(0), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS()))
|
|
|
|
|
mReader (0), mDialogue (0), mReaderIndex(1), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS()))
|
|
|
|
|
{
|
|
|
|
|
mResourceSystem->getSceneManager()->setShaderPath((resDir / "shaders").string());
|
|
|
|
|
|
|
|
|
@ -899,7 +899,7 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base
|
|
|
|
|
|
|
|
|
|
mReader = new ESM::ESMReader;
|
|
|
|
|
mReader->setEncoder (&mEncoder);
|
|
|
|
|
mReader->setIndex(mReaderIndex++);
|
|
|
|
|
mReader->setIndex((project || !base) ? 0 : mReaderIndex++);
|
|
|
|
|
mReader->open (path.string());
|
|
|
|
|
|
|
|
|
|
mContentFileNames.insert(std::make_pair(path.filename().string(), mReader->getIndex()));
|
|
|
|
@ -924,24 +924,9 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base
|
|
|
|
|
if (nameResult != mContentFileNames.end())
|
|
|
|
|
{
|
|
|
|
|
ESM::Header::MasterData& hackedMasterData = const_cast<ESM::Header::MasterData&>(*masterData);
|
|
|
|
|
hackedMasterData.index = nameResult->second;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Needed for saving
|
|
|
|
|
if (!mBase)
|
|
|
|
|
{
|
|
|
|
|
mReverseContentFiles.insert(std::make_pair(mReader->getIndex(), 0));
|
|
|
|
|
}
|
|
|
|
|
if (mProject)
|
|
|
|
|
{
|
|
|
|
|
mReverseContentFiles.insert(std::make_pair(mReader->getIndex(), 0));
|
|
|
|
|
|
|
|
|
|
// A new project has no header, so extrapolate the content files from the reader index
|
|
|
|
|
// The base/project index of 0 will not be overwritten
|
|
|
|
|
for (int i = 0; i < mReader->getIndex(); ++i)
|
|
|
|
|
{
|
|
|
|
|
mReverseContentFiles.insert(std::make_pair(i, i+1));
|
|
|
|
|
hackedMasterData.index = nameResult->second;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1202,16 +1187,6 @@ int CSMWorld::Data::count (RecordBase::State state) const
|
|
|
|
|
count (state, mPathgrids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CSMWorld::Data::getPluginContentFile(int currentContentFile)
|
|
|
|
|
{
|
|
|
|
|
std::map<int, int>::iterator searchResult = mReverseContentFiles.find(currentContentFile);
|
|
|
|
|
|
|
|
|
|
if (searchResult != mReverseContentFiles.end())
|
|
|
|
|
return searchResult->second;
|
|
|
|
|
else
|
|
|
|
|
return 0; // Assume faulty plugin with original content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> ids;
|
|
|
|
|