mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 11:09:41 +00:00
simplifying merge stage
This commit is contained in:
parent
16dda281ce
commit
40753aa9a3
1 changed files with 4 additions and 21 deletions
|
@ -35,8 +35,6 @@ namespace CSMTools
|
||||||
MergeState& mState;
|
MergeState& mState;
|
||||||
Collection& (CSMWorld::Data::*mAccessor)();
|
Collection& (CSMWorld::Data::*mAccessor)();
|
||||||
|
|
||||||
static const int stepSize = 1000;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MergeIdCollectionStage (MergeState& state, Collection& (CSMWorld::Data::*accessor)());
|
MergeIdCollectionStage (MergeState& state, Collection& (CSMWorld::Data::*accessor)());
|
||||||
|
@ -56,16 +54,7 @@ namespace CSMTools
|
||||||
template<typename RecordType, typename Collection>
|
template<typename RecordType, typename Collection>
|
||||||
int MergeIdCollectionStage<RecordType, Collection>::setup()
|
int MergeIdCollectionStage<RecordType, Collection>::setup()
|
||||||
{
|
{
|
||||||
const Collection& source = (mState.mSource.getData().*mAccessor)();
|
return (mState.mSource.getData().*mAccessor)().getSize();
|
||||||
|
|
||||||
int size = source.getSize();
|
|
||||||
|
|
||||||
int steps = size / stepSize;
|
|
||||||
|
|
||||||
if (size % stepSize)
|
|
||||||
++steps;
|
|
||||||
|
|
||||||
return steps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RecordType, typename Collection>
|
template<typename RecordType, typename Collection>
|
||||||
|
@ -74,16 +63,10 @@ namespace CSMTools
|
||||||
const Collection& source = (mState.mSource.getData().*mAccessor)();
|
const Collection& source = (mState.mSource.getData().*mAccessor)();
|
||||||
Collection& target = (mState.mTarget->getData().*mAccessor)();
|
Collection& target = (mState.mTarget->getData().*mAccessor)();
|
||||||
|
|
||||||
int begin = stage * stepSize;
|
const CSMWorld::Record<RecordType>& record = source.getRecord (stage);
|
||||||
int end = std::min ((stage+1) * stepSize, source.getSize());
|
|
||||||
|
|
||||||
for (int i=begin; i<end; ++i)
|
if (!record.isDeleted())
|
||||||
{
|
target.appendRecord (CSMWorld::Record<RecordType> (CSMWorld::RecordBase::State_BaseOnly, &record.get()));
|
||||||
const CSMWorld::Record<RecordType>& record = source.getRecord (i);
|
|
||||||
|
|
||||||
if (!record.isDeleted())
|
|
||||||
target.appendRecord (CSMWorld::Record<RecordType> (CSMWorld::RecordBase::State_BaseOnly, &record.get()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue