Issue #68: Remove dead actors from actor list

This commit is contained in:
Marc Zinnschlag 2012-10-20 10:54:51 +02:00
parent f2e25b8a47
commit 0547f11564

View file

@ -200,13 +200,23 @@ namespace MWMechanics
float totalDuration = mDuration; float totalDuration = mDuration;
mDuration = 0; mDuration = 0;
for (std::set<MWWorld::Ptr>::iterator iter (mActors.begin()); iter!=mActors.end(); ++iter) std::set<MWWorld::Ptr>::iterator iter (mActors.begin());
while (iter!=mActors.end())
{
if (!MWWorld::Class::get (*iter).getCreatureStats (*iter).isDead())
{ {
updateActor (*iter, totalDuration); updateActor (*iter, totalDuration);
if (iter->getTypeName()==typeid (ESM::NPC).name()) if (iter->getTypeName()==typeid (ESM::NPC).name())
updateNpc (*iter, totalDuration, paused); updateNpc (*iter, totalDuration, paused);
} }
if (MWWorld::Class::get (*iter).getCreatureStats (*iter).isDead())
mActors.erase (iter++);
else
++iter;
}
} }
for (std::set<MWWorld::Ptr>::iterator iter (mActors.begin()); iter!=mActors.end(); for (std::set<MWWorld::Ptr>::iterator iter (mActors.begin()); iter!=mActors.end();