mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
fixed merge stage order; added proper initialisation
This commit is contained in:
parent
a97a632aa7
commit
b7983d08ba
4 changed files with 38 additions and 1 deletions
|
@ -9,7 +9,8 @@
|
||||||
CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::FromType encoding)
|
CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::FromType encoding)
|
||||||
: CSMDoc::Operation (CSMDoc::State_Merging, true), mState (document)
|
: CSMDoc::Operation (CSMDoc::State_Merging, true), mState (document)
|
||||||
{
|
{
|
||||||
appendStage (new FinishMergedDocumentStage (mState, encoding));
|
appendStage (new StartMergeStage (mState));
|
||||||
|
|
||||||
appendStage (new MergeIdCollectionStage<ESM::Global> (mState, &CSMWorld::Data::getGlobals));
|
appendStage (new MergeIdCollectionStage<ESM::Global> (mState, &CSMWorld::Data::getGlobals));
|
||||||
appendStage (new MergeIdCollectionStage<ESM::GameSetting> (mState, &CSMWorld::Data::getGmsts));
|
appendStage (new MergeIdCollectionStage<ESM::GameSetting> (mState, &CSMWorld::Data::getGmsts));
|
||||||
appendStage (new MergeIdCollectionStage<ESM::Skill> (mState, &CSMWorld::Data::getSkills));
|
appendStage (new MergeIdCollectionStage<ESM::Skill> (mState, &CSMWorld::Data::getSkills));
|
||||||
|
@ -37,6 +38,8 @@ CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::Fr
|
||||||
appendStage (new MergeRefIdsStage (mState));
|
appendStage (new MergeRefIdsStage (mState));
|
||||||
appendStage (new MergeReferencesStage (mState));
|
appendStage (new MergeReferencesStage (mState));
|
||||||
|
|
||||||
|
appendStage (new FinishMergedDocumentStage (mState, encoding));
|
||||||
|
|
||||||
/// \todo Land, LandTextures
|
/// \todo Land, LandTextures
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,23 @@
|
||||||
#include "../doc/document.hpp"
|
#include "../doc/document.hpp"
|
||||||
#include "../world/data.hpp"
|
#include "../world/data.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
CSMTools::StartMergeStage::StartMergeStage (MergeState& state)
|
||||||
|
: mState (state)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int CSMTools::StartMergeStage::setup()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMTools::StartMergeStage::perform (int stage, CSMDoc::Messages& messages)
|
||||||
|
{
|
||||||
|
mState.mCompleted = false;
|
||||||
|
mState.mTextureIndices.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CSMTools::FinishMergedDocumentStage::FinishMergedDocumentStage (MergeState& state, ToUTF8::FromType encoding)
|
CSMTools::FinishMergedDocumentStage::FinishMergedDocumentStage (MergeState& state, ToUTF8::FromType encoding)
|
||||||
: mState (state), mEncoder (encoding)
|
: mState (state), mEncoder (encoding)
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -14,6 +14,21 @@
|
||||||
|
|
||||||
namespace CSMTools
|
namespace CSMTools
|
||||||
{
|
{
|
||||||
|
class StartMergeStage : public CSMDoc::Stage
|
||||||
|
{
|
||||||
|
MergeState& mState;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
StartMergeStage (MergeState& state);
|
||||||
|
|
||||||
|
virtual int setup();
|
||||||
|
///< \return number of steps
|
||||||
|
|
||||||
|
virtual void perform (int stage, CSMDoc::Messages& messages);
|
||||||
|
///< Messages resulting from this stage will be appended to \a messages.
|
||||||
|
};
|
||||||
|
|
||||||
class FinishMergedDocumentStage : public CSMDoc::Stage
|
class FinishMergedDocumentStage : public CSMDoc::Stage
|
||||||
{
|
{
|
||||||
MergeState& mState;
|
MergeState& mState;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define CSM_TOOLS_MERGESTATE_H
|
#define CSM_TOOLS_MERGESTATE_H
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "../doc/document.hpp"
|
#include "../doc/document.hpp"
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ namespace CSMTools
|
||||||
std::auto_ptr<CSMDoc::Document> mTarget;
|
std::auto_ptr<CSMDoc::Document> mTarget;
|
||||||
CSMDoc::Document& mSource;
|
CSMDoc::Document& mSource;
|
||||||
bool mCompleted;
|
bool mCompleted;
|
||||||
|
std::map<std::pair<int, int>, int> mTextureIndices; // (texture, content file) -> new texture
|
||||||
|
|
||||||
MergeState (CSMDoc::Document& source) : mSource (source), mCompleted (false) {}
|
MergeState (CSMDoc::Document& source) : mSource (source), mCompleted (false) {}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue