mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 06:40:09 +00:00
Fix excessive auto-equipping in InventoryStore::removeItem (Fixes #2792)
This commit is contained in:
parent
7900631d51
commit
7e4e59efb9
@ -490,6 +490,7 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||||||
{
|
{
|
||||||
int retCount = ContainerStore::remove(item, count, actor);
|
int retCount = ContainerStore::remove(item, count, actor);
|
||||||
|
|
||||||
|
bool wasEquipped = false;
|
||||||
if (!item.getRefData().getCount())
|
if (!item.getRefData().getCount())
|
||||||
{
|
{
|
||||||
for (int slot=0; slot < MWWorld::InventoryStore::Slots; ++slot)
|
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)
|
if (*mSlots[slot] == item)
|
||||||
{
|
{
|
||||||
unequipSlot(slot, actor);
|
unequipSlot(slot, actor);
|
||||||
|
wasEquipped = true;
|
||||||
break;
|
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,
|
// If an armor/clothing item is removed, try to find a replacement,
|
||||||
// but not for the player nor werewolves.
|
// 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()))
|
&& !(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()))
|
||||||
{
|
{
|
||||||
std::string type = item.getTypeName();
|
std::string type = item.getTypeName();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user