forked from mirror/openmw-tes3mp
Merge cleanup.
This commit is contained in:
parent
6d9d98c02c
commit
98c38ad7d1
3 changed files with 48 additions and 0 deletions
|
@ -41,6 +41,7 @@ CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::Fr
|
|||
appendStage (new PopulateLandTexturesMergeStage (mState));
|
||||
appendStage (new MergeLandStage (mState));
|
||||
appendStage (new FixLandsAndLandTexturesMergeStage (mState));
|
||||
appendStage (new CleanupLandTexturesMergeStage (mState));
|
||||
|
||||
appendStage (new FinishMergedDocumentStage (mState, encoding));
|
||||
}
|
||||
|
|
|
@ -180,5 +180,36 @@ void CSMTools::FixLandsAndLandTexturesMergeStage::perform (int stage, CSMDoc::Me
|
|||
|
||||
CSMWorld::TouchLandCommand cmd(landTable, ltexTable, id);
|
||||
cmd.redo();
|
||||
|
||||
// Get rid of base data
|
||||
const CSMWorld::Record<CSMWorld::Land>& oldRecord =
|
||||
mState.mTarget->getData().getLand().getRecord (stage);
|
||||
|
||||
CSMWorld::Record<CSMWorld::Land> newRecord(CSMWorld::RecordBase::State_ModifiedOnly,
|
||||
nullptr, &oldRecord.get());
|
||||
|
||||
mState.mTarget->getData().getLand().setRecord(stage, newRecord);
|
||||
}
|
||||
}
|
||||
|
||||
CSMTools::CleanupLandTexturesMergeStage::CleanupLandTexturesMergeStage (MergeState& state)
|
||||
: mState (state)
|
||||
{
|
||||
}
|
||||
|
||||
int CSMTools::CleanupLandTexturesMergeStage::setup()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CSMTools::CleanupLandTexturesMergeStage::perform (int stage, CSMDoc::Messages& messages)
|
||||
{
|
||||
auto& landTextures = mState.mTarget->getData().getLandTextures();
|
||||
for (int i = 0; i < landTextures.getSize(); )
|
||||
{
|
||||
if (!landTextures.getRecord(i).isModified())
|
||||
landTextures.removeRows(i, 1);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,6 +162,22 @@ namespace CSMTools
|
|||
virtual void perform (int stage, CSMDoc::Messages& messages);
|
||||
///< Messages resulting from this stage will be appended to \a messages.
|
||||
};
|
||||
|
||||
// Removes base LandTexture records.
|
||||
class CleanupLandTexturesMergeStage : public CSMDoc::Stage
|
||||
{
|
||||
MergeState& mState;
|
||||
|
||||
public:
|
||||
|
||||
CleanupLandTexturesMergeStage (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.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue