From afa39d121fe8c19e1b5112f71c4a6e6f05cca04a Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 23 Feb 2017 22:58:41 +0100 Subject: [PATCH] Fix 'part has no parent' warning caused by destructing in the wrong order --- apps/openmw/mwrender/npcanimation.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index e95626c82..aa53c41ac 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -269,6 +269,7 @@ const NpcAnimation::PartBoneMap NpcAnimation::sPartList = createPartListMap(); NpcAnimation::~NpcAnimation() { + mAmmunition.reset(); } NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr parentNode, Resource::ResourceSystem* resourceSystem, @@ -880,6 +881,7 @@ void NpcAnimation::addControllers() void NpcAnimation::showWeapons(bool showWeapon) { mShowWeapons = showWeapon; + mAmmunition.reset(); if(showWeapon) { MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr); @@ -898,11 +900,7 @@ void NpcAnimation::showWeapons(bool showWeapon) MWWorld::ContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition); if (ammo != inv.end() && ammo->get()->mBase->mData.mType == ESM::Weapon::Bolt) attachArrow(); - else - mAmmunition.reset(); } - else - mAmmunition.reset(); } } else