1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-10 20:06:42 +00:00

Merge branch 'enchanted-item-selected-fix' into 'master'

Fix for enchanted items being removed on item equip cycling when they are re-equipped

See merge request OpenMW/openmw!714
This commit is contained in:
psi29a 2021-05-05 07:27:00 +00:00
commit b8128d09f9

View file

@ -91,14 +91,30 @@ namespace MWWorld
// move all slots one towards begin(), then equip the item in the slot that is now free // move all slots one towards begin(), then equip the item in the slot that is now free
if (slot == slots_.first.end()) if (slot == slots_.first.end())
{ {
ContainerStoreIterator enchItem = invStore.getSelectedEnchantItem();
bool reEquip = false;
for (slot = slots_.first.begin(); slot != slots_.first.end(); ++slot) for (slot = slots_.first.begin(); slot != slots_.first.end(); ++slot)
{ {
invStore.unequipSlot(*slot, actor, false); invStore.unequipSlot(*slot, actor, false);
if (slot + 1 != slots_.first.end()) if (slot + 1 != slots_.first.end())
{
invStore.equip(*slot, invStore.getSlot(*(slot + 1)), actor); invStore.equip(*slot, invStore.getSlot(*(slot + 1)), actor);
}
else else
{
invStore.equip(*slot, it, actor); invStore.equip(*slot, it, actor);
} }
//Fix for issue of selected enchated item getting remmoved on cycle
if (invStore.getSlot(*slot) == enchItem)
{
reEquip = true;
}
}
if (reEquip)
{
invStore.setSelectedEnchantItem(enchItem);
}
} }
} }
} }