Avoid a map lookup for every skin body part when updating

This commit is contained in:
Chris Robinson 2013-07-12 22:30:25 -07:00
parent 6de56615aa
commit 4df1f198a7

View file

@ -357,13 +357,17 @@ void NpcAnimation::updateParts(bool forceupdate)
} }
} }
const std::vector<const ESM::BodyPart*> &parts = sRaceMapping[thisCombination];
for(int part = ESM::PRT_Neck; part < ESM::PRT_Count; ++part) for(int part = ESM::PRT_Neck; part < ESM::PRT_Count; ++part)
{ {
const ESM::BodyPart* bodypart = sRaceMapping[thisCombination][part]; if(mPartPriorities[part] < 1)
if (mPartPriorities[part] < 1 && bodypart) {
const ESM::BodyPart* bodypart = parts[part];
if(bodypart)
addOrReplaceIndividualPart(part, -1,1, "meshes\\"+bodypart->mModel); addOrReplaceIndividualPart(part, -1,1, "meshes\\"+bodypart->mModel);
} }
} }
}
NifOgre::ObjectList NpcAnimation::insertBoundedPart(const std::string &model, int group, const std::string &bonename) NifOgre::ObjectList NpcAnimation::insertBoundedPart(const std::string &model, int group, const std::string &bonename)
{ {