mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Fix the inventory listener bug
This commit is contained in:
parent
e66e9916db
commit
b33fe8fb62
3 changed files with 8 additions and 1 deletions
|
@ -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…
Reference in a new issue