|
|
@ -29,13 +29,14 @@ void AiSequence::copy (const AiSequence& sequence)
|
|
|
|
mPackages.push_back ((*iter)->clone());
|
|
|
|
mPackages.push_back ((*iter)->clone());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AiSequence::AiSequence() : mDone (false), mLastAiPackage(-1) {}
|
|
|
|
AiSequence::AiSequence() : mDone (false), mRepeat(false), mLastAiPackage(-1) {}
|
|
|
|
|
|
|
|
|
|
|
|
AiSequence::AiSequence (const AiSequence& sequence)
|
|
|
|
AiSequence::AiSequence (const AiSequence& sequence)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
copy (sequence);
|
|
|
|
copy (sequence);
|
|
|
|
mDone = sequence.mDone;
|
|
|
|
mDone = sequence.mDone;
|
|
|
|
mLastAiPackage = sequence.mLastAiPackage;
|
|
|
|
mLastAiPackage = sequence.mLastAiPackage;
|
|
|
|
|
|
|
|
mRepeat = sequence.mRepeat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AiSequence& AiSequence::operator= (const AiSequence& sequence)
|
|
|
|
AiSequence& AiSequence::operator= (const AiSequence& sequence)
|
|
|
@ -231,7 +232,7 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
|
|
|
if (package->execute (actor,characterController,state,duration))
|
|
|
|
if (package->execute (actor,characterController,state,duration))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Put repeating noncombat AI packages on the end of the stack so they can be used again
|
|
|
|
// Put repeating noncombat AI packages on the end of the stack so they can be used again
|
|
|
|
if (isActualAiPackage(packageTypeId) && package->getRepeat())
|
|
|
|
if (isActualAiPackage(packageTypeId) && (mRepeat || package->getRepeat()))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mPackages.push_back(package->clone());
|
|
|
|
mPackages.push_back(package->clone());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -292,6 +293,7 @@ void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mRepeat=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// insert new package in correct place depending on priority
|
|
|
|
// insert new package in correct place depending on priority
|
|
|
@ -317,6 +319,10 @@ AiPackage* MWMechanics::AiSequence::getActivePackage()
|
|
|
|
|
|
|
|
|
|
|
|
void AiSequence::fill(const ESM::AIPackageList &list)
|
|
|
|
void AiSequence::fill(const ESM::AIPackageList &list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// If there is more than one package in the list, enable repeating
|
|
|
|
|
|
|
|
if (!list.mList.empty() && list.mList.begin() != (list.mList.end()-1))
|
|
|
|
|
|
|
|
mRepeat = true;
|
|
|
|
|
|
|
|
|
|
|
|
for (std::vector<ESM::AIPackage>::const_iterator it = list.mList.begin(); it != list.mList.end(); ++it)
|
|
|
|
for (std::vector<ESM::AIPackage>::const_iterator it = list.mList.begin(); it != list.mList.end(); ++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWMechanics::AiPackage* package;
|
|
|
|
MWMechanics::AiPackage* package;
|
|
|
@ -366,6 +372,19 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
|
|
|
|
if (!sequence.mPackages.empty())
|
|
|
|
if (!sequence.mPackages.empty())
|
|
|
|
clear();
|
|
|
|
clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If there is more than one non-combat, non-pursue package in the list, enable repeating.
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
for (std::vector<ESM::AiSequence::AiPackageContainer>::const_iterator it = sequence.mPackages.begin();
|
|
|
|
|
|
|
|
it != sequence.mPackages.end(); ++it)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (isActualAiPackage(it->mType))
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count > 1)
|
|
|
|
|
|
|
|
mRepeat = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load packages
|
|
|
|
for (std::vector<ESM::AiSequence::AiPackageContainer>::const_iterator it = sequence.mPackages.begin();
|
|
|
|
for (std::vector<ESM::AiSequence::AiPackageContainer>::const_iterator it = sequence.mPackages.begin();
|
|
|
|
it != sequence.mPackages.end(); ++it)
|
|
|
|
it != sequence.mPackages.end(); ++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
|