forked from mirror/openmw-tes3mp
Avoid some unnecessary copying when calling addPartGroup
This commit is contained in:
parent
9fedaf18d6
commit
be74859f05
2 changed files with 5 additions and 7 deletions
|
@ -228,15 +228,13 @@ void NpcAnimation::updateParts()
|
||||||
{
|
{
|
||||||
prio = ((slotlist[i].numReserveParts+1)<<1) + 0;
|
prio = ((slotlist[i].numReserveParts+1)<<1) + 0;
|
||||||
const ESM::Clothing *clothes = store->get<ESM::Clothing>()->mBase;
|
const ESM::Clothing *clothes = store->get<ESM::Clothing>()->mBase;
|
||||||
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
|
addPartGroup(slotlist[i].slot, prio, clothes->mParts.mParts);
|
||||||
addPartGroup(slotlist[i].slot, prio, parts);
|
|
||||||
}
|
}
|
||||||
else if(store->getTypeName() == typeid(ESM::Armor).name())
|
else if(store->getTypeName() == typeid(ESM::Armor).name())
|
||||||
{
|
{
|
||||||
prio = ((slotlist[i].numReserveParts+1)<<1) + 1;
|
prio = ((slotlist[i].numReserveParts+1)<<1) + 1;
|
||||||
const ESM::Armor *armor = store->get<ESM::Armor>()->mBase;
|
const ESM::Armor *armor = store->get<ESM::Armor>()->mBase;
|
||||||
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
|
addPartGroup(slotlist[i].slot, prio, armor->mParts.mParts);
|
||||||
addPartGroup(slotlist[i].slot, prio, parts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int res = 0;res < slotlist[i].numReserveParts;res++)
|
for(int res = 0;res < slotlist[i].numReserveParts;res++)
|
||||||
|
@ -392,11 +390,11 @@ bool NpcAnimation::addOrReplaceIndividualPart(int type, int group, int priority,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NpcAnimation::addPartGroup(int group, int priority, std::vector<ESM::PartReference> &parts)
|
void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::PartReference> &parts)
|
||||||
{
|
{
|
||||||
for(std::size_t i = 0; i < parts.size(); i++)
|
for(std::size_t i = 0; i < parts.size(); i++)
|
||||||
{
|
{
|
||||||
ESM::PartReference &part = parts[i];
|
const ESM::PartReference &part = parts[i];
|
||||||
|
|
||||||
const MWWorld::Store<ESM::BodyPart> &partStore =
|
const MWWorld::Store<ESM::BodyPart> &partStore =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>();
|
||||||
|
|
|
@ -91,7 +91,7 @@ private:
|
||||||
|
|
||||||
bool addOrReplaceIndividualPart(int type, int group, int priority, const std::string &mesh);
|
bool addOrReplaceIndividualPart(int type, int group, int priority, const std::string &mesh);
|
||||||
void removePartGroup(int group);
|
void removePartGroup(int group);
|
||||||
void addPartGroup(int group, int priority, std::vector<ESM::PartReference>& parts);
|
void addPartGroup(int group, int priority, const std::vector<ESM::PartReference> &parts);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node,
|
NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node,
|
||||||
|
|
Loading…
Reference in a new issue