Work around a problem with MWRender::Player::renderPlayer

NpcAnimation::setViewMode makes a call to the character controller, in the
mechanics manager, to forcefully update the character's state. This in turn
makes a call to the player's old NpcAniamtion object that was just deleted.

The mechanics manager will eventually remove and reinsert the player, so the
old character controller will be removed and a new one will get the right
Animation object again, but not in time for the setViewMode call.

There's many factors that all contribute to this run-around, which needs
discussion on how to best fix.
This commit is contained in:
Chris Robinson 2013-04-26 01:30:36 -07:00
parent 55ee4e65a9
commit b666f1d551

View file

@ -307,11 +307,11 @@ namespace MWRender
void Player::setAnimation(NpcAnimation *anim)
{
anim->setViewMode((mVanity.enabled || mPreviewMode || !mFirstPersonView) ?
NpcAnimation::VM_Normal : NpcAnimation::VM_FirstPerson);
delete mAnimation;
mAnimation = anim;
mAnimation->setViewMode((mVanity.enabled || mPreviewMode || !mFirstPersonView) ?
NpcAnimation::VM_Normal : NpcAnimation::VM_FirstPerson);
}
void Player::setHeight(float height)