forked from mirror/openmw-tes3mp
Read fallback settings in OpenCS
This commit is contained in:
parent
6546c05428
commit
11496b8075
6 changed files with 30 additions and 4 deletions
|
@ -8,6 +8,8 @@
|
|||
#include <components/vfs/manager.hpp>
|
||||
#include <components/vfs/registerarchives.hpp>
|
||||
|
||||
#include <components/fallback/validate.hpp>
|
||||
|
||||
#include <components/nifosg/nifloader.hpp>
|
||||
|
||||
#include "model/doc/document.hpp"
|
||||
|
@ -17,6 +19,8 @@
|
|||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
using namespace Fallback;
|
||||
|
||||
CS::Editor::Editor ()
|
||||
: mSettingsState (mCfgMgr), mDocumentManager (mCfgMgr),
|
||||
mViewManager (mDocumentManager), mPid(""),
|
||||
|
@ -100,6 +104,8 @@ std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfi
|
|||
("resources", boost::program_options::value<std::string>()->default_value("resources"))
|
||||
("fallback-archive", boost::program_options::value<std::vector<std::string> >()->
|
||||
default_value(std::vector<std::string>(), "fallback-archive")->multitoken())
|
||||
("fallback", boost::program_options::value<FallbackMap>()->default_value(FallbackMap(), "")
|
||||
->multitoken()->composing(), "fallback values")
|
||||
("script-blacklist", boost::program_options::value<std::vector<std::string> >()->default_value(std::vector<std::string>(), "")
|
||||
->multitoken(), "exclude specified script from the verifier (if the use of the blacklist is enabled)")
|
||||
("script-blacklist-use", boost::program_options::value<bool>()->implicit_value(true)
|
||||
|
@ -114,6 +120,8 @@ std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfi
|
|||
|
||||
mDocumentManager.setResourceDir (mResources = variables["resources"].as<std::string>());
|
||||
|
||||
mDocumentManager.setFallbackMap (variables["fallback"].as<FallbackMap>().mMap);
|
||||
|
||||
if (variables["script-blacklist-use"].as<bool>())
|
||||
mDocumentManager.setBlacklistedScripts (
|
||||
variables["script-blacklist"].as<std::vector<std::string> >());
|
||||
|
|
|
@ -2247,6 +2247,7 @@ void CSMDoc::Document::createBase()
|
|||
CSMDoc::Document::Document (const VFS::Manager* vfs, const Files::ConfigurationManager& configuration,
|
||||
const std::vector< boost::filesystem::path >& files, bool new_,
|
||||
const boost::filesystem::path& savePath, const boost::filesystem::path& resDir,
|
||||
const Fallback::Map* fallback,
|
||||
ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager,
|
||||
const std::vector<std::string>& blacklistedScripts)
|
||||
: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, resourcesManager),
|
||||
|
@ -2255,7 +2256,7 @@ CSMDoc::Document::Document (const VFS::Manager* vfs, const Files::ConfigurationM
|
|||
(savePath.filename().string() + ".project")),
|
||||
mSavingOperation (*this, mProjectPath, encoding),
|
||||
mSaving (&mSavingOperation),
|
||||
mResDir(resDir),
|
||||
mResDir(resDir), mFallbackMap(fallback),
|
||||
mRunner (mProjectPath), mDirty (false), mIdCompletionManager(mData)
|
||||
{
|
||||
if (mContentFiles.empty())
|
||||
|
|
|
@ -25,9 +25,13 @@
|
|||
|
||||
class QAbstractItemModel;
|
||||
|
||||
namespace Fallback
|
||||
{
|
||||
class Map;
|
||||
}
|
||||
|
||||
namespace VFS
|
||||
{
|
||||
|
||||
class Manager;
|
||||
}
|
||||
|
||||
|
@ -66,6 +70,7 @@ namespace CSMDoc
|
|||
Saving mSavingOperation;
|
||||
OperationHolder mSaving;
|
||||
boost::filesystem::path mResDir;
|
||||
const Fallback::Map* mFallbackMap;
|
||||
Blacklist mBlacklist;
|
||||
Runner mRunner;
|
||||
bool mDirty;
|
||||
|
@ -101,6 +106,7 @@ namespace CSMDoc
|
|||
Document (const VFS::Manager* vfs, const Files::ConfigurationManager& configuration,
|
||||
const std::vector< boost::filesystem::path >& files, bool new_,
|
||||
const boost::filesystem::path& savePath, const boost::filesystem::path& resDir,
|
||||
const Fallback::Map* fallback,
|
||||
ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager,
|
||||
const std::vector<std::string>& blacklistedScripts);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ CSMDoc::Document *CSMDoc::DocumentManager::makeDocument (
|
|||
const std::vector< boost::filesystem::path >& files,
|
||||
const boost::filesystem::path& savePath, bool new_)
|
||||
{
|
||||
return new Document (mVFS, mConfiguration, files, new_, savePath, mResDir, mEncoding, mResourcesManager, mBlacklistedScripts);
|
||||
return new Document (mVFS, mConfiguration, files, new_, savePath, mResDir, &mFallbackMap, mEncoding, mResourcesManager, mBlacklistedScripts);
|
||||
}
|
||||
|
||||
void CSMDoc::DocumentManager::insertDocument (CSMDoc::Document *document)
|
||||
|
@ -100,6 +100,11 @@ void CSMDoc::DocumentManager::setResourceDir (const boost::filesystem::path& par
|
|||
mResDir = boost::filesystem::system_complete(parResDir);
|
||||
}
|
||||
|
||||
void CSMDoc::DocumentManager::setFallbackMap(const std::map<std::string, std::string>& fallbackMap)
|
||||
{
|
||||
mFallbackMap = Fallback::Map(fallbackMap);
|
||||
}
|
||||
|
||||
void CSMDoc::DocumentManager::setEncoding (ToUTF8::FromType encoding)
|
||||
{
|
||||
mEncoding = encoding;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <QThread>
|
||||
|
||||
#include <components/to_utf8/to_utf8.hpp>
|
||||
#include <components/fallback/fallback.hpp>
|
||||
|
||||
#include "../world/resourcesmanager.hpp"
|
||||
|
||||
|
@ -67,6 +68,8 @@ namespace CSMDoc
|
|||
|
||||
void setResourceDir (const boost::filesystem::path& parResDir);
|
||||
|
||||
void setFallbackMap (const std::map<std::string, std::string>& fallbackMap);
|
||||
|
||||
void setEncoding (ToUTF8::FromType encoding);
|
||||
|
||||
void setBlacklistedScripts (const std::vector<std::string>& scriptIds);
|
||||
|
@ -78,6 +81,7 @@ namespace CSMDoc
|
|||
private:
|
||||
|
||||
boost::filesystem::path mResDir;
|
||||
Fallback::Map mFallbackMap;
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
|
@ -11,9 +11,11 @@ namespace Fallback
|
|||
/// @brief contains settings imported from the Morrowind INI file.
|
||||
class Map
|
||||
{
|
||||
const std::map<std::string,std::string> mFallbackMap;
|
||||
std::map<std::string,std::string> mFallbackMap;
|
||||
public:
|
||||
Map(const std::map<std::string,std::string>& fallback);
|
||||
Map() {}
|
||||
|
||||
std::string getFallbackString(const std::string& fall) const;
|
||||
float getFallbackFloat(const std::string& fall) const;
|
||||
int getFallbackInt(const std::string& fall) const;
|
||||
|
|
Loading…
Reference in a new issue