From 79055e281d882ee68ba2d2ef2abef65120254ed4 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 18 May 2012 13:54:07 +0200 Subject: [PATCH] Issue #256: Force update after building the player character --- apps/openmw/mwmechanics/actors.cpp | 3 --- apps/openmw/mwmechanics/actors.hpp | 7 +++++-- apps/openmw/mwmechanics/mechanicsmanager.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index b0bb1e3ef9..c527a645cd 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -32,9 +32,6 @@ namespace MWMechanics creatureStats.mDynamic[1].setBase (static_cast (intelligence + magickaFactor * intelligence)); creatureStats.mDynamic[2].setBase (strength+willpower+agility+endurance); - - for (int i=0; i<3; ++i) - creatureStats.mDynamic[i].setCurrent (creatureStats.mDynamic[i].getModified()); } void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused) diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index 37a00deecc..30e73ccf75 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -19,8 +19,6 @@ namespace MWMechanics std::set mActors; float mDuration; - void updateActor (const MWWorld::Ptr& ptr, float duration); - void updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused); void adjustMagicEffects (const MWWorld::Ptr& creature); @@ -41,6 +39,11 @@ namespace MWMechanics void update (std::vector >& movement, float duration, bool paused); ///< Update actor stats and store desired velocity vectors in \a movement + + void updateActor (const MWWorld::Ptr& ptr, float duration); + ///< This function is normally called automatically during the update process, but it can + /// also be called explicitly at any time to force an update. + }; } diff --git a/apps/openmw/mwmechanics/mechanicsmanager.cpp b/apps/openmw/mwmechanics/mechanicsmanager.cpp index 66a850b051..0c48d88944 100644 --- a/apps/openmw/mwmechanics/mechanicsmanager.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanager.cpp @@ -138,6 +138,12 @@ namespace MWMechanics } } } + + // forced update and current value adjustments + mActors.updateActor (ptr, 0); + + for (int i=0; i<3; ++i) + creatureStats.mDynamic[i].setCurrent (creatureStats.mDynamic[i].getModified()); }