mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
fixed pathgrid saving
This commit is contained in:
parent
be3b229a5f
commit
2d3ffc4483
3 changed files with 58 additions and 2 deletions
|
@ -78,8 +78,7 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
|
||||||
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::MagicEffect> >
|
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::MagicEffect> >
|
||||||
(mDocument.getData().getMagicEffects(), mState));
|
(mDocument.getData().getMagicEffects(), mState));
|
||||||
|
|
||||||
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<CSMWorld::Pathgrid> >
|
appendStage (new WritePathgridCollectionStage (mDocument, mState));
|
||||||
(mDocument.getData().getPathgrids(), mState));
|
|
||||||
|
|
||||||
appendStage (new WriteDialogueCollectionStage (mDocument, mState, false));
|
appendStage (new WriteDialogueCollectionStage (mDocument, mState, false));
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,46 @@ void CSMDoc::WriteCellCollectionStage::perform (int stage, Messages& messages)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSMDoc::WritePathgridCollectionStage::WritePathgridCollectionStage (Document& document,
|
||||||
|
SavingState& state)
|
||||||
|
: mDocument (document), mState (state)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int CSMDoc::WritePathgridCollectionStage::setup()
|
||||||
|
{
|
||||||
|
return mDocument.getData().getPathgrids().getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::WritePathgridCollectionStage::perform (int stage, Messages& messages)
|
||||||
|
{
|
||||||
|
const CSMWorld::Record<CSMWorld::Pathgrid>& pathgrid =
|
||||||
|
mDocument.getData().getPathgrids().getRecord (stage);
|
||||||
|
|
||||||
|
if (pathgrid.mState==CSMWorld::RecordBase::State_Modified ||
|
||||||
|
pathgrid.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
||||||
|
{
|
||||||
|
CSMWorld::Pathgrid record = pathgrid.get();
|
||||||
|
|
||||||
|
if (record.mId.substr (0, 1)=="#")
|
||||||
|
{
|
||||||
|
std::istringstream stream (record.mId.c_str());
|
||||||
|
char ignore;
|
||||||
|
stream >> ignore >> record.mData.mX >> record.mData.mY;
|
||||||
|
}
|
||||||
|
|
||||||
|
mState.getWriter().startRecord (record.sRecordId);
|
||||||
|
|
||||||
|
record.save (mState.getWriter());
|
||||||
|
|
||||||
|
mState.getWriter().endRecord (record.sRecordId);
|
||||||
|
}
|
||||||
|
else if (pathgrid.mState==CSMWorld::RecordBase::State_Deleted)
|
||||||
|
{
|
||||||
|
/// \todo write record with delete flag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
|
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
|
||||||
: mState (state)
|
: mState (state)
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -183,6 +183,23 @@ namespace CSMDoc
|
||||||
///< Messages resulting from this stage will be appended to \a messages.
|
///< Messages resulting from this stage will be appended to \a messages.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WritePathgridCollectionStage : public Stage
|
||||||
|
{
|
||||||
|
Document& mDocument;
|
||||||
|
SavingState& mState;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
WritePathgridCollectionStage (Document& document, SavingState& state);
|
||||||
|
|
||||||
|
virtual int setup();
|
||||||
|
///< \return number of steps
|
||||||
|
|
||||||
|
virtual void perform (int stage, Messages& messages);
|
||||||
|
///< Messages resulting from this stage will be appended to \a messages.
|
||||||
|
};
|
||||||
|
|
||||||
class CloseSaveStage : public Stage
|
class CloseSaveStage : public Stage
|
||||||
{
|
{
|
||||||
SavingState& mState;
|
SavingState& mState;
|
||||||
|
|
Loading…
Reference in a new issue