forked from teamnwah/openmw-tes3coop
Fix excessive auto-equipping in InventoryStore::removeItem (Fixes #2792)
This commit is contained in:
parent
7900631d51
commit
7e4e59efb9
1 changed files with 3 additions and 1 deletions
|
@ -490,6 +490,7 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||
{
|
||||
int retCount = ContainerStore::remove(item, count, actor);
|
||||
|
||||
bool wasEquipped = false;
|
||||
if (!item.getRefData().getCount())
|
||||
{
|
||||
for (int slot=0; slot < MWWorld::InventoryStore::Slots; ++slot)
|
||||
|
@ -500,6 +501,7 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||
if (*mSlots[slot] == item)
|
||||
{
|
||||
unequipSlot(slot, actor);
|
||||
wasEquipped = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -507,7 +509,7 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||
|
||||
// If an armor/clothing item is removed, try to find a replacement,
|
||||
// but not for the player nor werewolves.
|
||||
if ((actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (wasEquipped && (actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
&& !(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()))
|
||||
{
|
||||
std::string type = item.getTypeName();
|
||||
|
|
Loading…
Reference in a new issue