forked from teamnwah/openmw-tes3coop
Merge pull request #1008 from Internecine/bug3451-invalid-enchantments
Fixes Bug 3451 - Invalid Enchantment IDs
This commit is contained in:
commit
3374630e7b
2 changed files with 23 additions and 13 deletions
|
@ -395,7 +395,9 @@ namespace MWGui
|
|||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
if (info.enchant != "")
|
||||
{
|
||||
enchant = store.get<ESM::Enchantment>().find(info.enchant);
|
||||
enchant = store.get<ESM::Enchantment>().search(info.enchant);
|
||||
if (enchant)
|
||||
{
|
||||
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
|
||||
text += "\n#{sItemCastOnce}";
|
||||
else if (enchant->mData.mType == ESM::Enchantment::WhenStrikes)
|
||||
|
@ -405,6 +407,7 @@ namespace MWGui
|
|||
else if (enchant->mData.mType == ESM::Enchantment::ConstantEffect)
|
||||
text += "\n#{sItemCastConstant}";
|
||||
}
|
||||
}
|
||||
|
||||
// this the maximum width of the tooltip before it starts word-wrapping
|
||||
setCoord(0, 0, 300, 300);
|
||||
|
@ -472,9 +475,8 @@ namespace MWGui
|
|||
totalSize.width = std::max(totalSize.width, coord.width);
|
||||
}
|
||||
|
||||
if (info.enchant != "")
|
||||
if (enchant)
|
||||
{
|
||||
assert(enchant);
|
||||
MyGUI::Widget* enchantArea = mDynamicToolTipBox->createWidget<MyGUI::Widget>("",
|
||||
MyGUI::IntCoord(padding.left, totalSize.height, 300-padding.left, 300-totalSize.height),
|
||||
MyGUI::Align::Stretch);
|
||||
|
|
|
@ -1143,10 +1143,18 @@ namespace MWRender
|
|||
std::string enchantmentName = item.getClass().getEnchantment(item);
|
||||
if (enchantmentName.empty())
|
||||
return result;
|
||||
const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchantmentName);
|
||||
|
||||
const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().search(enchantmentName);
|
||||
if (!enchantment)
|
||||
return result;
|
||||
|
||||
assert (enchantment->mEffects.mList.size());
|
||||
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(
|
||||
|
||||
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().search(
|
||||
enchantment->mEffects.mList.front().mEffectID);
|
||||
if (!magicEffect)
|
||||
return result;
|
||||
|
||||
result.x() = magicEffect->mData.mRed / 255.f;
|
||||
result.y() = magicEffect->mData.mGreen / 255.f;
|
||||
result.z() = magicEffect->mData.mBlue / 255.f;
|
||||
|
|
Loading…
Reference in a new issue