Fix AI sequence looping code (bug #5706)

pull/3034/head
Alexei Dobrohotov 3 years ago
parent 3e87c35005
commit f5af09aed9

@ -72,6 +72,7 @@
Bug #5688: Water shader broken indoors with enable indoor shadows = false
Bug #5695: ExplodeSpell for actors doesn't target the ground
Bug #5703: OpenMW-CS menu system crashing on XFCE
Bug #5706: AI sequences stop looping after the saved game is reloaded
Bug #5731: Editor: skirts are invisible on characters
Feature #390: 3rd person look "over the shoulder"
Feature #1536: Show more information about level on menu

@ -403,7 +403,7 @@ const AiPackage& MWMechanics::AiSequence::getActivePackage()
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))
if (list.mList.size() >= 2)
mRepeat = true;
for (const auto& esmPackage : list.mList)
@ -459,8 +459,15 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
int count = 0;
for (auto& container : sequence.mPackages)
{
if (isActualAiPackage(static_cast<AiPackageTypeId>(container.mType)))
count++;
switch (container.mType)
{
case ESM::AiSequence::Ai_Wander:
case ESM::AiSequence::Ai_Travel:
case ESM::AiSequence::Ai_Escort:
case ESM::AiSequence::Ai_Follow:
case ESM::AiSequence::Ai_Activate:
++count;
}
}
if (count > 1)

Loading…
Cancel
Save