Fix crash caused by teleportation spells (Fixes #1904)

deque
scrawl 10 years ago
parent 8ad2b95208
commit f56711f443

@ -1175,14 +1175,26 @@ namespace MWMechanics
iter->second->updateContinuousVfx(); iter->second->updateContinuousVfx();
// Animation/movement update // Animation/movement update
CharacterController* playerCharacter = NULL;
for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter) for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
{ {
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get( if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
ESM::MagicEffect::Paralyze).getMagnitude() > 0) ESM::MagicEffect::Paralyze).getMagnitude() > 0)
iter->second->skipAnim(); iter->second->skipAnim();
// Handle player last, in case a cell transition occurs by casting a teleportation spell
// (would invalidate the iterator)
if (iter->first.getCellRef().getRefId() == "player")
{
playerCharacter = iter->second;
continue;
}
iter->second->update(duration); iter->second->update(duration);
} }
if (playerCharacter)
playerCharacter->update(duration);
for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter) for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
{ {
const MWWorld::Class &cls = iter->first.getClass(); const MWWorld::Class &cls = iter->first.getClass();

Loading…
Cancel
Save