From 411b6dcd8e581a58106b16e12c2b8e4dcae7a796 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 18 May 2020 14:46:20 +0300 Subject: [PATCH] Don't clear spells for a dead player, preventing resurrection problems --- apps/openmw/mwmechanics/actors.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 223d9fc34..55f8feb87 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1865,13 +1865,17 @@ namespace MWMechanics } else if (killResult == CharacterController::Result_DeathAnimJustFinished) { + bool isPlayer = iter->first == getPlayer(); notifyDied(iter->first); // Reset magic effects and recalculate derived effects // One case where we need this is to make sure bound items are removed upon death stats.modifyMagicEffects(MWMechanics::MagicEffects()); stats.getActiveSpells().clear(); - stats.getSpells().clear(); + + if (!isPlayer) + stats.getSpells().clear(); + // Make sure spell effects are removed purgeSpellEffects(stats.getActorId()); @@ -1880,7 +1884,7 @@ namespace MWMechanics if (iter->first.getClass().isNpc()) calculateNpcStatModifiers(iter->first, 0); - if( iter->first == getPlayer()) + if (isPlayer) { //player's death animation is over MWBase::Environment::get().getStateManager()->askLoadRecent();