mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 15:41:13 -04:00
Update weapon/magic icons when items are removed from player inventory
This commit is contained in:
parent
d05baa8c22
commit
52cef19982
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
@ -339,6 +340,26 @@ void MWWorld::InventoryStore::unequipSlot(int slot, const MWWorld::Ptr& actor)
|
|||||||
{
|
{
|
||||||
equip(slot, end());
|
equip(slot, end());
|
||||||
|
|
||||||
|
if (actor.getRefData().getHandle() == "player")
|
||||||
|
{
|
||||||
|
// Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
|
||||||
|
const std::string& script = Class::get(*it).getScript(*it);
|
||||||
|
if (script != "")
|
||||||
|
(*it).getRefData().getLocals().setVarByInt(script, "onpcequip", 0);
|
||||||
|
|
||||||
|
// Update HUD icon when removing player weapon or selected enchanted item.
|
||||||
|
// We have to check for both as the weapon could also be the enchanted item.
|
||||||
|
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
||||||
|
{
|
||||||
|
// weapon
|
||||||
|
MWBase::Environment::get().getWindowManager()->unsetSelectedWeapon();
|
||||||
|
}
|
||||||
|
if ((mSelectedEnchantItem != end()) && (mSelectedEnchantItem == it))
|
||||||
|
{
|
||||||
|
// enchanted item
|
||||||
|
MWBase::Environment::get().getWindowManager()->unsetSelectedSpell();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// \todo update actor model
|
/// \todo update actor model
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user