mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 11:06:43 +00:00
Remove useless throwing of exception
This commit is contained in:
parent
3380e1e1c5
commit
4b5f02f644
2 changed files with 20 additions and 21 deletions
|
@ -53,9 +53,14 @@ namespace MWMechanics
|
||||||
return std::string();
|
return std::string();
|
||||||
std::string item = candidates[std::rand()%candidates.size()];
|
std::string item = candidates[std::rand()%candidates.size()];
|
||||||
|
|
||||||
// Is this another levelled item or a real item?
|
// Vanilla doesn't fail on nonexistent items in levelled lists
|
||||||
try
|
if (!MWBase::Environment::get().getWorld()->getStore().find(Misc::StringUtils::lowerCase(item)))
|
||||||
{
|
{
|
||||||
|
std::cerr << "Warning: ignoring nonexistent item '" << item << "' in levelled list '" << levItem->mId << "'" << std::endl;
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is this another levelled item or a real item?
|
||||||
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), item, 1);
|
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), item, 1);
|
||||||
if (ref.getPtr().getTypeName() != typeid(ESM::ItemLevList).name()
|
if (ref.getPtr().getTypeName() != typeid(ESM::ItemLevList).name()
|
||||||
&& ref.getPtr().getTypeName() != typeid(ESM::CreatureLevList).name())
|
&& ref.getPtr().getTypeName() != typeid(ESM::CreatureLevList).name())
|
||||||
|
@ -70,13 +75,6 @@ namespace MWMechanics
|
||||||
return getLevelledItem(ref.getPtr().get<ESM::CreatureLevList>()->mBase, failChance);
|
return getLevelledItem(ref.getPtr().get<ESM::CreatureLevList>()->mBase, failChance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::logic_error&)
|
|
||||||
{
|
|
||||||
// Vanilla doesn't fail on nonexistent items in levelled lists
|
|
||||||
std::cerr << "Warning: ignoring nonexistent item '" << item << "'" << std::endl;
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,8 @@ namespace MWWorld
|
||||||
return mStores.end();
|
return mStores.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look up the given ID in 'all'. Returns 0 if not found.
|
/// Look up the given ID in 'all'. Returns 0 if not found.
|
||||||
|
/// \note id must be in lower case.
|
||||||
int find(const std::string &id) const
|
int find(const std::string &id) const
|
||||||
{
|
{
|
||||||
std::map<std::string, int>::const_iterator it = mIds.find(id);
|
std::map<std::string, int>::const_iterator it = mIds.find(id);
|
||||||
|
|
Loading…
Reference in a new issue