From 5ea596f38d8e84d0086621fdb8f95ff9edf54de9 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Thu, 30 Jul 2015 08:15:45 -0400 Subject: [PATCH] Refactor onChooseActionStatePerFrameActions This prevents playIdle errors from tyring to play idleAnimation 0 --- apps/openmw/mwmechanics/aiwander.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index e3ce4ae2a7..f05040b663 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -392,18 +392,24 @@ namespace MWMechanics short unsigned& idleAnimation = storage.mIdleAnimation; idleAnimation = getRandomIdle(); + //If we should be moving if (!idleAnimation && mDistance) { storage.mState = Wander_MoveNow; } else { - // Play idle animation and recreate vanilla (broken?) behavior of resetting start time of AIWander: + //Recreate vanilla (broken?) behavior of resetting start time of AIWander: MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp(); mStartTime = currentTime; - playIdle(actor, idleAnimation); storage.mState = Wander_IdleNow; } + + //If we aren't going to just stand + if(idleAnimation) + { + playIdle(actor, idleAnimation); + } } void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage, float duration)