From ff9cb22a58fc9dbb233b223a15e93b3914ed428e Mon Sep 17 00:00:00 2001 From: glbwsk Date: Fri, 13 Oct 2017 15:16:07 +0200 Subject: [PATCH] npc swap cheaper ring during auto equip --- apps/openmw/mwworld/inventorystore.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index c28e6a109..40f9c741a 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -321,13 +321,23 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor) else if (iter.getType() == ContainerStore::Type_Clothing) { // if left ring is equipped - if (*iter2 == MWWorld::InventoryStore::Slot_LeftRing) + if (*iter2 == Slot_LeftRing) { // if there is a place for right ring dont swap left leaving right hand empty - if (slots_.at(MWWorld::InventoryStore::Slot_RightRing) == end()) + if (slots_.at(Slot_RightRing) == end()) { continue; } + else // if right ring is equipped too + { + Ptr rightRing = *slots_.at(Slot_RightRing); + + // we want to swap cheaper ring only if both are equipped + if (rightRing.getClass().getValue(rightRing) < old.getClass().getValue(old)) + { + continue; + } + } } if (old.getTypeName() == typeid(ESM::Clothing).name())