1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Revert "Bug #991: Don't autoequip items with harmful permanent enchantments"

This is no longer needed, since merchants no longer equip items sold to them (2f35e5a04e). Also, items with harmful enchantments that are initially in the NPCs inventory *must* be equipped (e.g. slave bracers)

This reverts commit 71d9755ef1.
This commit is contained in:
scrawl 2014-01-14 05:24:58 +01:00
parent 9de3abcb5f
commit 6aa56354c0

View file

@ -195,29 +195,6 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
std::pair<std::vector<int>, bool> itemsSlots = std::pair<std::vector<int>, bool> itemsSlots =
MWWorld::Class::get (*iter).getEquipmentSlots (*iter); MWWorld::Class::get (*iter).getEquipmentSlots (*iter);
// Skip items that have *only* harmful permanent effects
if (!test.getClass().getEnchantment(test).empty())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Enchantment* enchantment = store.get<ESM::Enchantment>().find(test.getClass().getEnchantment(test));
bool harmfulEffect = false;
bool usefulEffect = false;
if (enchantment->mData.mType == ESM::Enchantment::ConstantEffect)
{
for (std::vector<ESM::ENAMstruct>::const_iterator it = enchantment->mEffects.mList.begin();
it != enchantment->mEffects.mList.end(); ++it)
{
const ESM::MagicEffect* effect = store.get<ESM::MagicEffect>().find(it->mEffectID);
if (effect->mData.mFlags & ESM::MagicEffect::Harmful)
harmfulEffect = true;
else
usefulEffect = true;
}
}
if (harmfulEffect && !usefulEffect)
continue;
}
for (std::vector<int>::const_iterator iter2 (itemsSlots.first.begin()); for (std::vector<int>::const_iterator iter2 (itemsSlots.first.begin());
iter2!=itemsSlots.first.end(); ++iter2) iter2!=itemsSlots.first.end(); ++iter2)
{ {