mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +00:00
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 <iostream>
|
||||
#include <cassert>
|
||||
|
||||
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)
|
||||
std::cout << "pretending to load " << iter->string() << std::endl;
|
||||
assert (begin!=end);
|
||||
|
||||
/// \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()
|
||||
|
@ -48,7 +56,7 @@ CSMDoc::Document::Document (const std::vector<boost::filesystem::path>& files, b
|
|||
if (new_)
|
||||
--end;
|
||||
|
||||
load (files.begin(), end);
|
||||
load (files.begin(), end, !new_);
|
||||
}
|
||||
|
||||
if (new_ && files.size()==1)
|
||||
|
@ -134,10 +142,10 @@ void CSMDoc::Document::saving()
|
|||
|
||||
if (mSaveCount>15)
|
||||
{
|
||||
mSaveCount = 0;
|
||||
mSaveTimer.stop();
|
||||
mUndoStack.setClean();
|
||||
emit stateChanged (getState(), this);
|
||||
mSaveCount = 0;
|
||||
mSaveTimer.stop();
|
||||
mUndoStack.setClean();
|
||||
emit stateChanged (getState(), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ namespace CSMDoc
|
|||
Document& operator= (const Document&);
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -59,4 +59,9 @@ QAbstractTableModel *CSMWorld::Data::getTableModel (const UniversalId& id)
|
|||
void CSMWorld::Data::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 <vector>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <components/esm/loadglob.hpp>
|
||||
|
||||
#include "idcollection.hpp"
|
||||
|
@ -44,6 +46,9 @@ namespace CSMWorld
|
|||
|
||||
void merge();
|
||||
///< 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