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,11 +357,15 @@ void NpcAnimation::updateParts(bool forceupdate)
} }
} }
for (int part = ESM::PRT_Neck; part < ESM::PRT_Count; ++part) const std::vector<const ESM::BodyPart*> &parts = sRaceMapping[thisCombination];
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) {
addOrReplaceIndividualPart(part, -1,1, "meshes\\"+bodypart->mModel); const ESM::BodyPart* bodypart = parts[part];
if(bodypart)
addOrReplaceIndividualPart(part, -1,1, "meshes\\"+bodypart->mModel);
}
} }
} }