Workaround for some AI functions being incorrectly handled as AI packages (Bug #3378)

pull/1/head
scrawl 9 years ago
parent 9959b2553d
commit 93b2f09224

@ -41,6 +41,7 @@ namespace MWMechanics
TypeIdActivate = 4,
// These 3 are not really handled as Ai Packages in the MW engine
// For compatibility do *not* return these in the getCurrentAiPackage script function..
TypeIdCombat = 5,
TypeIdPursue = 6,
TypeIdAvoidDoor = 7

@ -166,10 +166,15 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
}
MWMechanics::AiPackage* package = mPackages.front();
mLastAiPackage = package->getTypeId();
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)
mLastAiPackage = packageTypeId;
// if active package is combat one, choose nearest target
if (mLastAiPackage == AiPackage::TypeIdCombat)
if (packageTypeId == AiPackage::TypeIdCombat)
{
std::list<AiPackage *>::iterator itActualCombat;
@ -216,7 +221,6 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
}
package = mPackages.front();
mLastAiPackage = package->getTypeId();
}
else
{

Loading…
Cancel
Save