forked from teamnwah/openmw-tes3coop
Clean up a for loop
This commit is contained in:
parent
81cf2008d7
commit
47a9a4cdff
1 changed files with 11 additions and 12 deletions
|
@ -453,24 +453,23 @@ bool NpcAnimation::addOrReplaceIndividualPart(int type, int group, int priority,
|
||||||
|
|
||||||
void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::PartReference> &parts)
|
void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::PartReference> &parts)
|
||||||
{
|
{
|
||||||
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
const MWWorld::Store<ESM::BodyPart> &partStore = store.get<ESM::BodyPart>();
|
||||||
|
|
||||||
const char *ext = (mViewMode == VM_FirstPerson) ? ".1st" : "";
|
const char *ext = (mViewMode == VM_FirstPerson) ? ".1st" : "";
|
||||||
for(std::size_t i = 0; i < parts.size(); i++)
|
std::vector<ESM::PartReference>::const_iterator part(parts.begin());
|
||||||
|
for(;part != parts.end();part++)
|
||||||
{
|
{
|
||||||
const ESM::PartReference &part = parts[i];
|
|
||||||
|
|
||||||
const MWWorld::Store<ESM::BodyPart> &partStore =
|
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>();
|
|
||||||
|
|
||||||
const ESM::BodyPart *bodypart = 0;
|
const ESM::BodyPart *bodypart = 0;
|
||||||
if(!mNpc->isMale())
|
if(!mNpc->isMale() && !part->mFemale.empty())
|
||||||
bodypart = partStore.search(part.mFemale+ext);
|
bodypart = partStore.search(part->mFemale+ext);
|
||||||
if(!bodypart)
|
if(!bodypart && !part->mMale.empty())
|
||||||
bodypart = partStore.search(part.mMale+ext);
|
bodypart = partStore.search(part->mMale+ext);
|
||||||
|
|
||||||
if(bodypart)
|
if(bodypart)
|
||||||
addOrReplaceIndividualPart(part.mPart, group, priority, "meshes\\"+bodypart->mModel);
|
addOrReplaceIndividualPart(part->mPart, group, priority, "meshes\\"+bodypart->mModel);
|
||||||
else
|
else
|
||||||
reserveIndividualPart(part.mPart, group, priority);
|
reserveIndividualPart(part->mPart, group, priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue