From fb849014bd2c413fe8bb9114ab99f5e31ada73b7 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 6 Jan 2016 13:09:53 +0100 Subject: [PATCH] Pass the fallback map to CSMWorld::Data --- apps/opencs/model/doc/document.cpp | 2 +- apps/opencs/model/world/data.cpp | 10 ++++++++-- apps/opencs/model/world/data.hpp | 10 +++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 59d66f36c..80c14bd98 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -2250,7 +2250,7 @@ CSMDoc::Document::Document (const VFS::Manager* vfs, const Files::ConfigurationM const Fallback::Map* fallback, ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager, const std::vector& blacklistedScripts) -: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, resourcesManager), +: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, resourcesManager, fallback), mTools (*this, encoding), mProjectPath ((configuration.getUserDataPath() / "projects") / (savePath.filename().string() + ".project")), diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 1f98b2475..6eccb7483 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -59,9 +59,10 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec return number; } -CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager) +CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager, const Fallback::Map* fallback) : mEncoder (encoding), mPathgrids (mCells), mRefs (mCells), - mResourcesManager (resourcesManager), mReader (0), mDialogue (0), mReaderIndex(0), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS())) + mResourcesManager (resourcesManager), mFallbackMap(fallback), + mReader (0), mDialogue (0), mReaderIndex(0), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS())) { int index = 0; @@ -1201,3 +1202,8 @@ const VFS::Manager* CSMWorld::Data::getVFS() const { return mResourcesManager.getVFS(); } + +const Fallback::Map* CSMWorld::Data::getFallbackMap() const +{ + return mFallbackMap; +} diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index c6623279a..e5b8229c4 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -58,6 +58,11 @@ namespace VFS class Manager; } +namespace Fallback +{ + class Map; +} + namespace ESM { class ESMReader; @@ -104,6 +109,7 @@ namespace CSMWorld IdCollection mFilters; Collection mMetaData; const ResourcesManager& mResourcesManager; + const Fallback::Map* mFallbackMap; std::vector mModels; std::map mModelIndex; ESM::ESMReader *mReader; @@ -132,12 +138,14 @@ namespace CSMWorld public: - Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager); + Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager, const Fallback::Map* fallback); virtual ~Data(); const VFS::Manager* getVFS() const; + const Fallback::Map* getFallbackMap() const; + boost::shared_ptr getResourceSystem(); boost::shared_ptr getResourceSystem() const;