mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 07:36:41 +00:00
removed WriteFilterStage class (functionality integrated into WriteCollectionStage)
This commit is contained in:
parent
828536e999
commit
0be1e3d12f
3 changed files with 11 additions and 35 deletions
|
@ -17,7 +17,8 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
|
||||||
|
|
||||||
appendStage (new WriteHeaderStage (mDocument, mState, true));
|
appendStage (new WriteHeaderStage (mDocument, mState, true));
|
||||||
|
|
||||||
appendStage (new WriteFilterStage (mDocument, mState, CSMFilter::Filter::Scope_Project));
|
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<CSMFilter::Filter> > (
|
||||||
|
mDocument.getData().getFilters(), mState, CSMWorld::Scope_Project));
|
||||||
|
|
||||||
appendStage (new CloseSaveStage (mState));
|
appendStage (new CloseSaveStage (mState));
|
||||||
|
|
||||||
|
|
|
@ -201,23 +201,6 @@ void CSMDoc::WriteRefIdCollectionStage::perform (int stage, Messages& messages)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CSMDoc::WriteFilterStage::WriteFilterStage (Document& document, SavingState& state,
|
|
||||||
CSMFilter::Filter::Scope scope)
|
|
||||||
: WriteCollectionStage<CSMWorld::IdCollection<CSMFilter::Filter> > (document.getData().getFilters(),
|
|
||||||
state),
|
|
||||||
mDocument (document), mScope (scope)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void CSMDoc::WriteFilterStage::perform (int stage, Messages& messages)
|
|
||||||
{
|
|
||||||
const CSMWorld::Record<CSMFilter::Filter>& record =
|
|
||||||
mDocument.getData().getFilters().getRecord (stage);
|
|
||||||
|
|
||||||
if (record.get().mScope==mScope)
|
|
||||||
WriteCollectionStage<CSMWorld::IdCollection<CSMFilter::Filter> >::perform (stage, messages);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CSMDoc::CollectionReferencesStage::CollectionReferencesStage (Document& document,
|
CSMDoc::CollectionReferencesStage::CollectionReferencesStage (Document& document,
|
||||||
SavingState& state)
|
SavingState& state)
|
||||||
: mDocument (document), mState (state)
|
: mDocument (document), mState (state)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "../world/record.hpp"
|
#include "../world/record.hpp"
|
||||||
#include "../world/idcollection.hpp"
|
#include "../world/idcollection.hpp"
|
||||||
|
#include "../world/scope.hpp"
|
||||||
|
|
||||||
#include "../filter/filter.hpp"
|
#include "../filter/filter.hpp"
|
||||||
|
|
||||||
|
@ -67,10 +68,12 @@ namespace CSMDoc
|
||||||
{
|
{
|
||||||
const CollectionT& mCollection;
|
const CollectionT& mCollection;
|
||||||
SavingState& mState;
|
SavingState& mState;
|
||||||
|
CSMWorld::Scope mScope;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
WriteCollectionStage (const CollectionT& collection, SavingState& state);
|
WriteCollectionStage (const CollectionT& collection, SavingState& state,
|
||||||
|
CSMWorld::Scope scope = CSMWorld::Scope_Content);
|
||||||
|
|
||||||
virtual int setup();
|
virtual int setup();
|
||||||
///< \return number of steps
|
///< \return number of steps
|
||||||
|
@ -81,8 +84,8 @@ namespace CSMDoc
|
||||||
|
|
||||||
template<class CollectionT>
|
template<class CollectionT>
|
||||||
WriteCollectionStage<CollectionT>::WriteCollectionStage (const CollectionT& collection,
|
WriteCollectionStage<CollectionT>::WriteCollectionStage (const CollectionT& collection,
|
||||||
SavingState& state)
|
SavingState& state, CSMWorld::Scope scope)
|
||||||
: mCollection (collection), mState (state)
|
: mCollection (collection), mState (state), mScope (scope)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class CollectionT>
|
template<class CollectionT>
|
||||||
|
@ -94,6 +97,9 @@ namespace CSMDoc
|
||||||
template<class CollectionT>
|
template<class CollectionT>
|
||||||
void WriteCollectionStage<CollectionT>::perform (int stage, Messages& messages)
|
void WriteCollectionStage<CollectionT>::perform (int stage, Messages& messages)
|
||||||
{
|
{
|
||||||
|
if (CSMWorld::getScopeFromId (mCollection.getRecord (stage).get().mId)!=mScope)
|
||||||
|
return;
|
||||||
|
|
||||||
CSMWorld::RecordBase::State state = mCollection.getRecord (stage).mState;
|
CSMWorld::RecordBase::State state = mCollection.getRecord (stage).mState;
|
||||||
|
|
||||||
if (state==CSMWorld::RecordBase::State_Modified ||
|
if (state==CSMWorld::RecordBase::State_Modified ||
|
||||||
|
@ -152,20 +158,6 @@ namespace CSMDoc
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WriteFilterStage : public WriteCollectionStage<CSMWorld::IdCollection<CSMFilter::Filter> >
|
|
||||||
{
|
|
||||||
Document& mDocument;
|
|
||||||
CSMFilter::Filter::Scope mScope;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
WriteFilterStage (Document& document, SavingState& state, CSMFilter::Filter::Scope scope);
|
|
||||||
|
|
||||||
virtual void perform (int stage, Messages& messages);
|
|
||||||
///< Messages resulting from this stage will be appended to \a messages.
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class CollectionReferencesStage : public Stage
|
class CollectionReferencesStage : public Stage
|
||||||
{
|
{
|
||||||
Document& mDocument;
|
Document& mDocument;
|
||||||
|
|
Loading…
Reference in a new issue