From 3b31e8f66e5e78779b41e99809d34519ad9f221e Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 14 May 2016 19:19:37 +0200 Subject: [PATCH] Do not set AiPackageDone flag for non-Aipackages (Fixes #3392) --- apps/openmw/mwmechanics/aisequence.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 7d0bd55ff..9f6b71db5 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -155,6 +155,13 @@ bool AiSequence::isPackageDone() const return mDone; } +bool isActualAiPackage(int packageTypeId) +{ + return (packageTypeId != AiPackage::TypeIdCombat + && packageTypeId != AiPackage::TypeIdPursue + && packageTypeId != AiPackage::TypeIdAvoidDoor); +} + void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) { if(actor != getPlayer()) @@ -168,11 +175,8 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac MWMechanics::AiPackage* package = mPackages.front(); int packageTypeId = package->getTypeId(); // workaround ai packages not being handled as in the vanilla engine - if (packageTypeId != AiPackage::TypeIdCombat - && packageTypeId != AiPackage::TypeIdPursue - && packageTypeId != AiPackage::TypeIdAvoidDoor) + if (isActualAiPackage(packageTypeId)) mLastAiPackage = packageTypeId; - // if active package is combat one, choose nearest target if (packageTypeId == AiPackage::TypeIdCombat) { @@ -222,11 +226,6 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac package = mPackages.front(); } - else - { - mDone = true; - return; - } } if (package->execute (actor,characterController,state,duration)) @@ -237,7 +236,8 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac std::find(mPackages.begin(), mPackages.end(), package); mPackages.erase(toRemove); delete package; - mDone = true; + if (isActualAiPackage(packageTypeId)) + mDone = true; } else {