forked from mirror/openmw-tes3mp
Remove missing souls, remove some runaway exceptions (Fixes #4111)
This commit is contained in:
parent
7f39dbb129
commit
870c658500
4 changed files with 19 additions and 8 deletions
|
@ -83,7 +83,8 @@ namespace MWClass
|
||||||
|
|
||||||
if (ptr.getCellRef().getSoul() != "")
|
if (ptr.getCellRef().getSoul() != "")
|
||||||
{
|
{
|
||||||
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(ref->mRef.getSoul());
|
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(ref->mRef.getSoul());
|
||||||
|
if (creature)
|
||||||
value *= creature->mData.mSoul;
|
value *= creature->mData.mSoul;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +149,8 @@ namespace MWClass
|
||||||
|
|
||||||
if (ref->mRef.getSoul() != "")
|
if (ref->mRef.getSoul() != "")
|
||||||
{
|
{
|
||||||
const ESM::Creature *creature = store.get<ESM::Creature>().find(ref->mRef.getSoul());
|
const ESM::Creature *creature = store.get<ESM::Creature>().search(ref->mRef.getSoul());
|
||||||
|
if (creature)
|
||||||
info.caption += " (" + creature->mName + ")";
|
info.caption += " (" + creature->mName + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +212,7 @@ namespace MWClass
|
||||||
|
|
||||||
std::shared_ptr<MWWorld::Action> Miscellaneous::use (const MWWorld::Ptr& ptr) const
|
std::shared_ptr<MWWorld::Action> Miscellaneous::use (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
if (ptr.getCellRef().getSoul().empty())
|
if (ptr.getCellRef().getSoul().empty() || !MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(ptr.getCellRef().getSoul()))
|
||||||
return std::shared_ptr<MWWorld::Action>(new MWWorld::NullAction());
|
return std::shared_ptr<MWWorld::Action>(new MWWorld::NullAction());
|
||||||
else
|
else
|
||||||
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionSoulgem(ptr));
|
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionSoulgem(ptr));
|
||||||
|
|
|
@ -208,7 +208,7 @@ namespace MWGui
|
||||||
if ((mFilter & Filter_OnlyEnchanted) && !(item.mFlags & ItemStack::Flag_Enchanted))
|
if ((mFilter & Filter_OnlyEnchanted) && !(item.mFlags & ItemStack::Flag_Enchanted))
|
||||||
return false;
|
return false;
|
||||||
if ((mFilter & Filter_OnlyChargedSoulstones) && (base.getTypeName() != typeid(ESM::Miscellaneous).name()
|
if ((mFilter & Filter_OnlyChargedSoulstones) && (base.getTypeName() != typeid(ESM::Miscellaneous).name()
|
||||||
|| base.getCellRef().getSoul() == ""))
|
|| base.getCellRef().getSoul() == "" || !MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(base.getCellRef().getSoul())))
|
||||||
return false;
|
return false;
|
||||||
if ((mFilter & Filter_OnlyRepairTools) && (base.getTypeName() != typeid(ESM::Repair).name()))
|
if ((mFilter & Filter_OnlyRepairTools) && (base.getTypeName() != typeid(ESM::Repair).name()))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -242,8 +242,11 @@ namespace MWMechanics
|
||||||
return 0;
|
return 0;
|
||||||
if(mSoulGemPtr.getCellRef().getSoul()=="")
|
if(mSoulGemPtr.getCellRef().getSoul()=="")
|
||||||
return 0;
|
return 0;
|
||||||
const ESM::Creature* soul = store.get<ESM::Creature>().find(mSoulGemPtr.getCellRef().getSoul());
|
const ESM::Creature* soul = store.get<ESM::Creature>().search(mSoulGemPtr.getCellRef().getSoul());
|
||||||
|
if(soul)
|
||||||
return soul->mData.mSoul;
|
return soul->mData.mSoul;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Enchanting::getMaxEnchantValue() const
|
int Enchanting::getMaxEnchantValue() const
|
||||||
|
|
|
@ -48,6 +48,12 @@ void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state)
|
||||||
}
|
}
|
||||||
|
|
||||||
mClass->readAdditionalState (ptr, state);
|
mClass->readAdditionalState (ptr, state);
|
||||||
|
|
||||||
|
if (!mRef.getSoul().empty() && !MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(mRef.getSoul()))
|
||||||
|
{
|
||||||
|
std::cerr << "Soul '" << mRef.getSoul() << "' not found, removing the soul from soul gem" << std::endl;
|
||||||
|
mRef.setSoul(std::string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::LiveCellRefBase::saveImp (ESM::ObjectState& state) const
|
void MWWorld::LiveCellRefBase::saveImp (ESM::ObjectState& state) const
|
||||||
|
|
Loading…
Reference in a new issue