forked from teamnwah/openmw-tes3coop
Fixes #894: Make sure the player's CharacterController is updated when the player is rebuilt. Necessary if the race is changed while we are still in a GUI (e.g. in the review dialog), and an update normally wouldn't occur.
This commit is contained in:
parent
386604bc9d
commit
e591d23880
3 changed files with 5 additions and 3 deletions
|
@ -781,7 +781,7 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::addActor (const MWWorld::Ptr& ptr)
|
void Actors::addActor (const MWWorld::Ptr& ptr, bool updateImmediately)
|
||||||
{
|
{
|
||||||
// erase previous death events since we are currently only tracking them while in an active cell
|
// erase previous death events since we are currently only tracking them while in an active cell
|
||||||
MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied();
|
MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied();
|
||||||
|
@ -790,6 +790,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr);
|
MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr);
|
||||||
mActors.insert(std::make_pair(ptr, new CharacterController(ptr, anim)));
|
mActors.insert(std::make_pair(ptr, new CharacterController(ptr, anim)));
|
||||||
|
if (updateImmediately)
|
||||||
|
mActors[ptr]->update(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::removeActor (const MWWorld::Ptr& ptr)
|
void Actors::removeActor (const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace MWMechanics
|
||||||
/// paused we may want to do it manually (after equipping permanent enchantment)
|
/// 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) { adjustMagicEffects(ptr); }
|
||||||
|
|
||||||
void addActor (const MWWorld::Ptr& ptr);
|
void addActor (const MWWorld::Ptr& ptr, bool updateImmediately=false);
|
||||||
///< Register an actor for stats management
|
///< Register an actor for stats management
|
||||||
///
|
///
|
||||||
/// \note Dead actors are ignored.
|
/// \note Dead actors are ignored.
|
||||||
|
|
|
@ -385,7 +385,7 @@ namespace MWMechanics
|
||||||
// have been made for them. Make sure they're properly updated.
|
// have been made for them. Make sure they're properly updated.
|
||||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
mActors.removeActor(ptr);
|
mActors.removeActor(ptr);
|
||||||
mActors.addActor(ptr);
|
mActors.addActor(ptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
mActors.update(duration, paused);
|
mActors.update(duration, paused);
|
||||||
|
|
Loading…
Reference in a new issue