Replaced Store::find usage with Store::search to remove exception handlers.

This commit is contained in:
Internecine 2016-08-02 11:43:41 +12:00
parent 14165352f6
commit 90735d226d
2 changed files with 8 additions and 22 deletions

View file

@ -395,9 +395,9 @@ namespace MWGui
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
if (info.enchant != "") if (info.enchant != "")
{ {
try enchant = store.get<ESM::Enchantment>().search(info.enchant);
if (enchant)
{ {
enchant = store.get<ESM::Enchantment>().find(info.enchant);
if (enchant->mData.mType == ESM::Enchantment::CastOnce) if (enchant->mData.mType == ESM::Enchantment::CastOnce)
text += "\n#{sItemCastOnce}"; text += "\n#{sItemCastOnce}";
else if (enchant->mData.mType == ESM::Enchantment::WhenStrikes) else if (enchant->mData.mType == ESM::Enchantment::WhenStrikes)
@ -407,10 +407,6 @@ namespace MWGui
else if (enchant->mData.mType == ESM::Enchantment::ConstantEffect) else if (enchant->mData.mType == ESM::Enchantment::ConstantEffect)
text += "\n#{sItemCastConstant}"; text += "\n#{sItemCastConstant}";
} }
catch (const std::runtime_error& ex)
{
}
} }
// this the maximum width of the tooltip before it starts word-wrapping // this the maximum width of the tooltip before it starts word-wrapping

View file

@ -1144,27 +1144,17 @@ namespace MWRender
if (enchantmentName.empty()) if (enchantmentName.empty())
return result; return result;
const ESM::Enchantment* enchantment = NULL; const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().search(enchantmentName);
try if (!enchantment)
{
enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchantmentName);
}
catch (const std::runtime_error& ex)
{
return result; return result;
}
assert (enchantment->mEffects.mList.size()); assert (enchantment->mEffects.mList.size());
const ESM::MagicEffect* magicEffect = NULL; const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().search(
try
{
magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(
enchantment->mEffects.mList.front().mEffectID); enchantment->mEffects.mList.front().mEffectID);
} if (!magicEffect)
catch (const std::runtime_error& ex)
{
return result; return result;
}
result.x() = magicEffect->mData.mRed / 255.f; result.x() = magicEffect->mData.mRed / 255.f;
result.y() = magicEffect->mData.mGreen / 255.f; result.y() = magicEffect->mData.mGreen / 255.f;
result.z() = magicEffect->mData.mBlue / 255.f; result.z() = magicEffect->mData.mBlue / 255.f;