Fix equipment update removing ammunition (Fixes #2144)

moveref
scrawl 10 years ago
parent 18fb3f831a
commit 9c693d078b

@ -361,6 +361,8 @@ void NpcAnimation::updateParts()
};
static const size_t slotlistsize = sizeof(slotlist)/sizeof(slotlist[0]);
bool wasArrowAttached = (mAmmunition.get());
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
for(size_t i = 0;i < slotlistsize && mViewMode != VM_HeadOnly;i++)
{
@ -555,6 +557,9 @@ void NpcAnimation::updateParts()
"meshes\\"+bodypart->mModel);
}
}
if (wasArrowAttached)
attachArrow();
}
void NpcAnimation::addFirstPersonOffset(const Ogre::Vector3 &offset)

@ -49,6 +49,8 @@ void WeaponAnimation::attachArrow(MWWorld::Ptr actor)
else
{
NifOgre::ObjectScenePtr weapon = getWeapon();
if (!weapon.get())
return;
MWWorld::ContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition);
if (ammo == inv.end())
@ -66,6 +68,9 @@ void WeaponAnimation::attachArrow(MWWorld::Ptr actor)
void WeaponAnimation::releaseArrow(MWWorld::Ptr actor)
{
if (!mAmmunition.get())
return;
MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor);
MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
if (weapon == inv.end())

Loading…
Cancel
Save