forked from teamnwah/openmw-tes3coop
handle missing land texture records properly during merge
This commit is contained in:
parent
73f6efddcc
commit
09ec60fe2a
1 changed files with 28 additions and 21 deletions
|
@ -164,35 +164,42 @@ void CSMTools::MergeLandTexturesStage::perform (int stage, CSMDoc::Messages& mes
|
||||||
if (stage==0)
|
if (stage==0)
|
||||||
mNext = mState.mTextureIndices.begin();
|
mNext = mState.mTextureIndices.begin();
|
||||||
|
|
||||||
if (mNext==mState.mTextureIndices.end())
|
bool found = false;
|
||||||
return;
|
|
||||||
|
|
||||||
mNext->second = stage;
|
do
|
||||||
|
|
||||||
std::ostringstream stream;
|
|
||||||
stream << mNext->first.first << "_" << mNext->first.second;
|
|
||||||
|
|
||||||
int index = mState.mSource.getData().getLandTextures().searchId (stream.str());
|
|
||||||
|
|
||||||
if (index!=-1)
|
|
||||||
{
|
{
|
||||||
CSMWorld::LandTexture texture =
|
if (mNext==mState.mTextureIndices.end())
|
||||||
mState.mSource.getData().getLandTextures().getRecord (index).get();
|
return;
|
||||||
|
|
||||||
|
mNext->second = stage;
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << mNext->second << "_0";
|
stream << mNext->first.first << "_" << mNext->first.second;
|
||||||
|
|
||||||
texture.mIndex = mNext->second;
|
int index = mState.mSource.getData().getLandTextures().searchId (stream.str());
|
||||||
texture.mId = stream.str();
|
|
||||||
|
|
||||||
CSMWorld::Record<CSMWorld::LandTexture> newRecord (
|
if (index!=-1)
|
||||||
CSMWorld::RecordBase::State_ModifiedOnly, 0, &texture);
|
{
|
||||||
|
CSMWorld::LandTexture texture =
|
||||||
|
mState.mSource.getData().getLandTextures().getRecord (index).get();
|
||||||
|
|
||||||
mState.mTarget->getData().getLandTextures().appendRecord (newRecord);
|
std::ostringstream stream;
|
||||||
|
stream << mNext->second << "_0";
|
||||||
|
|
||||||
|
texture.mIndex = mNext->second;
|
||||||
|
texture.mId = stream.str();
|
||||||
|
|
||||||
|
CSMWorld::Record<CSMWorld::LandTexture> newRecord (
|
||||||
|
CSMWorld::RecordBase::State_ModifiedOnly, 0, &texture);
|
||||||
|
|
||||||
|
mState.mTarget->getData().getLandTextures().appendRecord (newRecord);
|
||||||
|
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
++mNext;
|
||||||
}
|
}
|
||||||
/// \todo deal with missing textures (either abort merge or report and make sure OpenMW can deal with missing textures)
|
while (!found);
|
||||||
|
|
||||||
++mNext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue