1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-29 16:06:44 +00:00

Error message fix

This commit is contained in:
scrawl 2014-12-17 00:57:04 +01:00
parent 88c5e1991c
commit d642512f71
2 changed files with 6 additions and 10 deletions

View file

@ -120,11 +120,10 @@ namespace MWClass
for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin()); for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin());
iter!=ref->mBase->mSpells.mList.end(); ++iter) iter!=ref->mBase->mSpells.mList.end(); ++iter)
{ {
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(*iter); if (const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(*iter))
if (spell)
data->mCreatureStats.getSpells().add (spell); data->mCreatureStats.getSpells().add (spell);
else /// \todo add option to make this a fatal error message pop-up, but default to warning for vanilla compatibility else /// \todo add option to make this a fatal error message pop-up, but default to warning for vanilla compatibility
std::cerr << "Warning: ignoring nonexistent spell '" << spell->mId << "' on creature '" << ref->mBase->mId << "'" << std::endl; std::cerr << "Warning: ignoring nonexistent spell '" << *iter << "' on creature '" << ref->mBase->mId << "'" << std::endl;
} }
// inventory // inventory

View file

@ -300,8 +300,7 @@ namespace MWClass
if (!ref->mBase->mFaction.empty()) if (!ref->mBase->mFaction.empty())
{ {
std::string faction = ref->mBase->mFaction; std::string faction = ref->mBase->mFaction;
const ESM::Faction* fact = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().search(faction); if (const ESM::Faction* fact = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().search(faction))
if (fact)
{ {
if(ref->mBase->mNpdtType != ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS) if(ref->mBase->mNpdtType != ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS)
{ {
@ -313,7 +312,7 @@ namespace MWClass
} }
} }
else else
std::cerr << "Warning: ignoring nonexistent faction '" << fact->mId << "' on NPC '" << ref->mBase->mId << "'" << std::endl; std::cerr << "Warning: ignoring nonexistent faction '" << faction << "' on NPC '" << ref->mBase->mId << "'" << std::endl;
} }
// creature stats // creature stats
@ -366,8 +365,7 @@ namespace MWClass
for (std::vector<std::string>::const_iterator iter (race->mPowers.mList.begin()); for (std::vector<std::string>::const_iterator iter (race->mPowers.mList.begin());
iter!=race->mPowers.mList.end(); ++iter) iter!=race->mPowers.mList.end(); ++iter)
{ {
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(*iter); if (const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(*iter))
if (spell)
data->mNpcStats.getSpells().add (spell); data->mNpcStats.getSpells().add (spell);
else else
std::cerr << "Warning: ignoring nonexistent race power '" << *iter << "' on NPC '" << ref->mBase->mId << "'" << std::endl; std::cerr << "Warning: ignoring nonexistent race power '" << *iter << "' on NPC '" << ref->mBase->mId << "'" << std::endl;
@ -395,8 +393,7 @@ namespace MWClass
for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin()); for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin());
iter!=ref->mBase->mSpells.mList.end(); ++iter) iter!=ref->mBase->mSpells.mList.end(); ++iter)
{ {
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(*iter); if (const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(*iter))
if (spell)
data->mNpcStats.getSpells().add (spell); data->mNpcStats.getSpells().add (spell);
else else
{ {