Add the parameter to AiSequence::stack() to control ability to cancel other AI packages

0.6.3
Andrei Kortunov 7 years ago
parent 9d27eb197f
commit 18ff097e4a

@ -298,7 +298,7 @@ void AiSequence::clear()
mPackages.clear();
}
void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor)
void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor, bool cancelOther)
{
if (actor == getPlayer())
throw std::runtime_error("Can't add AI packages to player");
@ -308,7 +308,7 @@ void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor)
stopCombat();
// remove previous packages if required
if (package.shouldCancelPreviousAi())
if (cancelOther && package.shouldCancelPreviousAi())
{
for(std::list<AiPackage *>::iterator it = mPackages.begin(); it != mPackages.end();)
{

@ -115,7 +115,7 @@ namespace MWMechanics
///< Add \a package to the front of the sequence
/** Suspends current package
@param actor The actor that owns this AiSequence **/
void stack (const AiPackage& package, const MWWorld::Ptr& actor);
void stack (const AiPackage& package, const MWWorld::Ptr& actor, bool cancelOther=true);
/// Return the current active package.
/** If there is no active package, it will throw an exception **/

@ -1611,7 +1611,7 @@ namespace MWMechanics
osg::Vec3f pos = ptr.getRefData().getPosition().asVec3();
MWMechanics::AiTravel travelPackage(pos.x(), pos.y(), pos.z());
aiSequence.stack(travelPackage, ptr);
aiSequence.stack(travelPackage, ptr, false);
}
aiSequence.stack(MWMechanics::AiCombat(target), ptr);

Loading…
Cancel
Save