mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 10:21:09 +00:00
load project files
This commit is contained in:
parent
62148b3247
commit
e7c48cbe58
@ -1,6 +1,9 @@
|
||||
#include "document.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
void CSMDoc::Document::load (const std::vector<boost::filesystem::path>::const_iterator& begin,
|
||||
const std::vector<boost::filesystem::path>::const_iterator& end, bool lastAsModified)
|
||||
{
|
||||
@ -12,10 +15,10 @@ void CSMDoc::Document::load (const std::vector<boost::filesystem::path>::const_i
|
||||
--end2;
|
||||
|
||||
for (std::vector<boost::filesystem::path>::const_iterator iter (begin); iter!=end2; ++iter)
|
||||
getData().loadFile (*iter, true);
|
||||
getData().loadFile (*iter, true, false);
|
||||
|
||||
if (lastAsModified)
|
||||
getData().loadFile (*end2, false);
|
||||
getData().loadFile (*end2, false, false);
|
||||
}
|
||||
|
||||
void CSMDoc::Document::addGmsts()
|
||||
@ -2164,6 +2167,18 @@ CSMDoc::Document::Document (const std::vector<boost::filesystem::path>& files,
|
||||
mData.setDescription ("");
|
||||
mData.setAuthor ("");
|
||||
}
|
||||
/// \todo un-outcomment the else, once loading an existing content file works properly again.
|
||||
// else
|
||||
{
|
||||
if (boost::filesystem::exists (projectPath))
|
||||
{
|
||||
getData().loadFile (projectPath, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// \todo create new project file with default filters
|
||||
}
|
||||
}
|
||||
|
||||
addOptionalGmsts();
|
||||
addOptionalGlobals();
|
||||
|
@ -386,7 +386,7 @@ void CSMWorld::Data::merge()
|
||||
mGlobals.merge();
|
||||
}
|
||||
|
||||
void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
||||
void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base, bool project)
|
||||
{
|
||||
ESM::ESMReader reader;
|
||||
|
||||
@ -449,6 +449,19 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
||||
case ESM::REC_STAT: mReferenceables.load (reader, base, UniversalId::Type_Static); break;
|
||||
case ESM::REC_WEAP: mReferenceables.load (reader, base, UniversalId::Type_Weapon); break;
|
||||
|
||||
case ESM::REC_FILT:
|
||||
|
||||
if (project)
|
||||
{
|
||||
mFilters.load (reader, base);
|
||||
mFilters.setData (mFilters.getSize()-1,
|
||||
mFilters.findColumnIndex (CSMWorld::Columns::ColumnId_Scope),
|
||||
static_cast<int> (CSMFilter::Filter::Scope_Project));
|
||||
break;
|
||||
}
|
||||
|
||||
// fall through (filter record in a content file is an error with format 0)
|
||||
|
||||
default:
|
||||
|
||||
/// \todo throw an exception instead, once all records are implemented
|
||||
|
@ -145,8 +145,10 @@ namespace CSMWorld
|
||||
void merge();
|
||||
///< Merge modified into base.
|
||||
|
||||
void loadFile (const boost::filesystem::path& path, bool base);
|
||||
void loadFile (const boost::filesystem::path& path, bool base, bool project);
|
||||
///< Merging content of a file into base or modified.
|
||||
///
|
||||
/// \param project load project file instead of content file
|
||||
|
||||
bool hasId (const std::string& id) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user