Fix the inventory listener bug

c++11
scrawl 10 years ago
parent e66e9916db
commit b33fe8fb62

@ -231,7 +231,7 @@ NpcAnimation::~NpcAnimation()
// No need to getInventoryStore() to reset, if none exists
// This is to avoid triggering the listener via ensureCustomData()->autoEquip()->fireEquipmentChanged()
// all from within this destructor. ouch!
&& mPtr.getRefData().getCustomData())
&& mPtr.getRefData().getCustomData() && mPtr.getClass().getInventoryStore(mPtr).getListener() == this)
mPtr.getClass().getInventoryStore(mPtr).setListener(NULL, mPtr);
}

@ -573,6 +573,11 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipItem(const MWWor
throw std::runtime_error ("attempt to unequip an item that is not currently equipped");
}
MWWorld::InventoryStoreListener* MWWorld::InventoryStore::getListener()
{
return mListener;
}
void MWWorld::InventoryStore::setListener(InventoryStoreListener *listener, const Ptr& actor)
{
mListener = listener;

@ -192,6 +192,8 @@ namespace MWWorld
void setListener (InventoryStoreListener* listener, const Ptr& actor);
///< Set a listener for various events, see \a InventoryStoreListener
InventoryStoreListener* getListener();
void visitEffectSources (MWMechanics::EffectSourceVisitor& visitor);
void rechargeItems (float duration);

Loading…
Cancel
Save