1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 11:23:51 +00:00

Make missing hair/head in NpcAnimation non-fatal for consistency with addOrReplaceIndividualPart

This commit is contained in:
scrawl 2015-01-22 03:36:12 +01:00
parent 5ce8a931a5
commit cc7be1600d

View file

@ -263,17 +263,27 @@ void NpcAnimation::updateNpcBase()
} }
else else
{ {
if (isVampire) mHeadModel = "";
if (isVampire) // FIXME: fall back to regular head when getVampireHead fails?
mHeadModel = getVampireHead(mNpc->mRace, mNpc->mFlags & ESM::NPC::Female); mHeadModel = getVampireHead(mNpc->mRace, mNpc->mFlags & ESM::NPC::Female);
else if (!mNpc->mHead.empty()) else if (!mNpc->mHead.empty())
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel; {
else const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(mNpc->mHead);
mHeadModel = ""; if (bp)
mHeadModel = "meshes\\" + bp->mModel;
else
std::cerr << "Failed to load body part '" << mNpc->mHead << "'" << std::endl;
}
mHairModel = "";
if (!mNpc->mHair.empty()) if (!mNpc->mHair.empty())
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel; {
else const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(mNpc->mHair);
mHairModel = ""; if (bp)
mHairModel = "meshes\\" + bp->mModel;
else
std::cerr << "Failed to load body part '" << mNpc->mHair << "'" << std::endl;
}
} }
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;