fireEquipmentChangedEvent() updates the InventoryWindow. (Fixes #2424)

test
dteviot 10 years ago
parent fe69dc2863
commit 0a5de33a1a

@ -10,6 +10,9 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwgui/inventorywindow.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/spellcasting.hpp" #include "../mwmechanics/spellcasting.hpp"
@ -175,7 +178,7 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
flagAsModified(); flagAsModified();
fireEquipmentChangedEvent(); fireEquipmentChangedEvent(actor);
updateMagicEffects(actor); updateMagicEffects(actor);
} }
@ -188,7 +191,7 @@ void MWWorld::InventoryStore::unequipAll(const MWWorld::Ptr& actor)
mUpdatesEnabled = true; mUpdatesEnabled = true;
fireEquipmentChangedEvent(); fireEquipmentChangedEvent(actor);
updateMagicEffects(actor); updateMagicEffects(actor);
} }
@ -318,7 +321,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
if (changed) if (changed)
{ {
mSlots.swap (slots_); mSlots.swap (slots_);
fireEquipmentChangedEvent(); fireEquipmentChangedEvent(actor);
updateMagicEffects(actor); updateMagicEffects(actor);
flagAsModified(); flagAsModified();
} }
@ -549,7 +552,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c
} }
} }
fireEquipmentChangedEvent(); fireEquipmentChangedEvent(actor);
updateMagicEffects(actor); updateMagicEffects(actor);
return retval; return retval;
@ -576,12 +579,18 @@ void MWWorld::InventoryStore::setListener(InventoryStoreListener *listener, cons
updateMagicEffects(actor); updateMagicEffects(actor);
} }
void MWWorld::InventoryStore::fireEquipmentChangedEvent() void MWWorld::InventoryStore::fireEquipmentChangedEvent(const Ptr& actor)
{ {
if (!mUpdatesEnabled) if (!mUpdatesEnabled)
return; return;
if (mListener) if (mListener)
mListener->equipmentChanged(); mListener->equipmentChanged();
// if player, update inventory window
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
{
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView();
}
} }
void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisitor &visitor) void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisitor &visitor)

@ -111,7 +111,7 @@ namespace MWWorld
void updateMagicEffects(const Ptr& actor); void updateMagicEffects(const Ptr& actor);
void updateRechargingItems(); void updateRechargingItems();
void fireEquipmentChangedEvent(); void fireEquipmentChangedEvent(const Ptr& actor);
virtual void storeEquipmentState (const MWWorld::LiveCellRefBase& ref, int index, ESM::InventoryState& inventory) const; virtual void storeEquipmentState (const MWWorld::LiveCellRefBase& ref, int index, ESM::InventoryState& inventory) const;
virtual void readEquipmentState (const MWWorld::ContainerStoreIterator& iter, int index, const ESM::InventoryState& inventory); virtual void readEquipmentState (const MWWorld::ContainerStoreIterator& iter, int index, const ESM::InventoryState& inventory);

Loading…
Cancel
Save