From 084cc857d4a8af8e8de1983a5ab0a3cf232c020a Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 15 Aug 2014 01:13:38 +0200 Subject: [PATCH] Update magic effects when changing equipment (Fixes #1646) --- apps/openmw/mwgui/inventorywindow.cpp | 3 +++ apps/openmw/mwmechanics/actors.cpp | 6 ++++++ apps/openmw/mwmechanics/actors.hpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index e2048a34b7..93c598d285 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -543,6 +543,9 @@ namespace MWGui if (MWBase::Environment::get().getWindowManager()->getSpellWindow()) MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells(); + MWBase::Environment::get().getMechanicsManager()->updateMagicEffects( + MWBase::Environment::get().getWorld()->getPlayerPtr()); + mPreviewDirty = true; } diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index dfec007d79..be3a90e0c8 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1458,4 +1458,10 @@ namespace MWMechanics mActors.clear(); mDeathCount.clear(); } + + void Actors::updateMagicEffects(const MWWorld::Ptr &ptr) + { + adjustMagicEffects(ptr); + calculateCreatureStatModifiers(ptr, 0.f); + } } diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index 4b5d77a7f8..f893f7596a 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -56,7 +56,7 @@ namespace MWMechanics /// Update magic effects for an actor. Usually done automatically once per frame, but if we're currently /// paused we may want to do it manually (after equipping permanent enchantment) - void updateMagicEffects (const MWWorld::Ptr& ptr) { adjustMagicEffects(ptr); } + void updateMagicEffects (const MWWorld::Ptr& ptr); void addActor (const MWWorld::Ptr& ptr, bool updateImmediately=false); ///< Register an actor for stats management