Do not set AiPackageDone flag for non-Aipackages (Fixes #3392)

pull/1/head
scrawl 9 years ago
parent fcbcc004a3
commit 3b31e8f66e

@ -155,6 +155,13 @@ bool AiSequence::isPackageDone() const
return mDone; 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) void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{ {
if(actor != getPlayer()) if(actor != getPlayer())
@ -168,11 +175,8 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
MWMechanics::AiPackage* package = mPackages.front(); MWMechanics::AiPackage* package = mPackages.front();
int packageTypeId = package->getTypeId(); int packageTypeId = package->getTypeId();
// workaround ai packages not being handled as in the vanilla engine // workaround ai packages not being handled as in the vanilla engine
if (packageTypeId != AiPackage::TypeIdCombat if (isActualAiPackage(packageTypeId))
&& packageTypeId != AiPackage::TypeIdPursue
&& packageTypeId != AiPackage::TypeIdAvoidDoor)
mLastAiPackage = packageTypeId; mLastAiPackage = packageTypeId;
// if active package is combat one, choose nearest target // if active package is combat one, choose nearest target
if (packageTypeId == AiPackage::TypeIdCombat) if (packageTypeId == AiPackage::TypeIdCombat)
{ {
@ -222,11 +226,6 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
package = mPackages.front(); package = mPackages.front();
} }
else
{
mDone = true;
return;
}
} }
if (package->execute (actor,characterController,state,duration)) 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); std::find(mPackages.begin(), mPackages.end(), package);
mPackages.erase(toRemove); mPackages.erase(toRemove);
delete package; delete package;
mDone = true; if (isActualAiPackage(packageTypeId))
mDone = true;
} }
else else
{ {

Loading…
Cancel
Save