forked from mirror/openmw-tes3mp
rewrote logic of content file loading
This commit is contained in:
parent
347a734364
commit
7d112e4d5c
4 changed files with 30 additions and 11 deletions
|
@ -1,15 +1,23 @@
|
||||||
|
|
||||||
#include "document.hpp"
|
#include "document.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <cassert>
|
||||||
|
|
||||||
void CSMDoc::Document::load (const std::vector<boost::filesystem::path>::const_iterator& begin,
|
void CSMDoc::Document::load (const std::vector<boost::filesystem::path>::const_iterator& begin,
|
||||||
const std::vector<boost::filesystem::path>::const_iterator& end)
|
const std::vector<boost::filesystem::path>::const_iterator& end, bool lastAsModified)
|
||||||
{
|
{
|
||||||
for (std::vector<boost::filesystem::path>::const_iterator iter (begin); iter!=end; ++iter)
|
assert (begin!=end);
|
||||||
std::cout << "pretending to load " << iter->string() << std::endl;
|
|
||||||
|
|
||||||
/// \todo load content files
|
std::vector<boost::filesystem::path>::const_iterator end2 (end);
|
||||||
|
|
||||||
|
if (lastAsModified)
|
||||||
|
--end2;
|
||||||
|
|
||||||
|
for (std::vector<boost::filesystem::path>::const_iterator iter (begin); iter!=end2; ++iter)
|
||||||
|
getData().loadFile (*iter, true);
|
||||||
|
|
||||||
|
if (lastAsModified)
|
||||||
|
getData().loadFile (*end2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Document::createBase()
|
void CSMDoc::Document::createBase()
|
||||||
|
@ -48,7 +56,7 @@ CSMDoc::Document::Document (const std::vector<boost::filesystem::path>& files, b
|
||||||
if (new_)
|
if (new_)
|
||||||
--end;
|
--end;
|
||||||
|
|
||||||
load (files.begin(), end);
|
load (files.begin(), end, !new_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_ && files.size()==1)
|
if (new_ && files.size()==1)
|
||||||
|
@ -134,10 +142,10 @@ void CSMDoc::Document::saving()
|
||||||
|
|
||||||
if (mSaveCount>15)
|
if (mSaveCount>15)
|
||||||
{
|
{
|
||||||
mSaveCount = 0;
|
mSaveCount = 0;
|
||||||
mSaveTimer.stop();
|
mSaveTimer.stop();
|
||||||
mUndoStack.setClean();
|
mUndoStack.setClean();
|
||||||
emit stateChanged (getState(), this);
|
emit stateChanged (getState(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@ namespace CSMDoc
|
||||||
Document& operator= (const Document&);
|
Document& operator= (const Document&);
|
||||||
|
|
||||||
void load (const std::vector<boost::filesystem::path>::const_iterator& begin,
|
void load (const std::vector<boost::filesystem::path>::const_iterator& begin,
|
||||||
const std::vector<boost::filesystem::path>::const_iterator& end);
|
const std::vector<boost::filesystem::path>::const_iterator& end, bool lastAsModified);
|
||||||
|
///< \param lastAsModified Store the last file in Modified instead of merging it into Base.
|
||||||
|
|
||||||
void createBase();
|
void createBase();
|
||||||
|
|
||||||
|
|
|
@ -59,4 +59,9 @@ QAbstractTableModel *CSMWorld::Data::getTableModel (const UniversalId& id)
|
||||||
void CSMWorld::Data::merge()
|
void CSMWorld::Data::merge()
|
||||||
{
|
{
|
||||||
mGlobals.merge();
|
mGlobals.merge();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
||||||
|
{
|
||||||
|
std::cout << "pretending to load " << path.string() << std::endl;
|
||||||
}
|
}
|
|
@ -4,6 +4,8 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <boost/filesystem/path.hpp>
|
||||||
|
|
||||||
#include <components/esm/loadglob.hpp>
|
#include <components/esm/loadglob.hpp>
|
||||||
|
|
||||||
#include "idcollection.hpp"
|
#include "idcollection.hpp"
|
||||||
|
@ -44,6 +46,9 @@ namespace CSMWorld
|
||||||
|
|
||||||
void merge();
|
void merge();
|
||||||
///< Merge modified into base.
|
///< Merge modified into base.
|
||||||
|
|
||||||
|
void loadFile (const boost::filesystem::path& path, bool base);
|
||||||
|
///< Merging content of a file into base or modified.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue