mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 07:19:54 +00:00
fixed merge stage order; added proper initialisation
(cherry picked from commit b7983d08ba
)
This commit is contained in:
parent
73ab89bf70
commit
e5038cbece
4 changed files with 38 additions and 1 deletions
|
@ -9,7 +9,8 @@
|
|||
CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::FromType encoding)
|
||||
: 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::GameSetting> (mState, &CSMWorld::Data::getGmsts));
|
||||
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 MergeReferencesStage (mState));
|
||||
|
||||
appendStage (new FinishMergedDocumentStage (mState, encoding));
|
||||
|
||||
/// \todo Land, LandTextures
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,23 @@
|
|||
#include "../doc/document.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)
|
||||
: mState (state), mEncoder (encoding)
|
||||
{}
|
||||
|
|
|
@ -14,6 +14,21 @@
|
|||
|
||||
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
|
||||
{
|
||||
MergeState& mState;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define CSM_TOOLS_MERGESTATE_H
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include "../doc/document.hpp"
|
||||
|
||||
|
@ -12,6 +13,7 @@ namespace CSMTools
|
|||
std::auto_ptr<CSMDoc::Document> mTarget;
|
||||
CSMDoc::Document& mSource;
|
||||
bool mCompleted;
|
||||
std::map<std::pair<int, int>, int> mTextureIndices; // (texture, content file) -> new texture
|
||||
|
||||
MergeState (CSMDoc::Document& source) : mSource (source), mCompleted (false) {}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue