mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:23:53 +00:00
Fix #6633: AiSequence packages being removed incorrectly
This commit is contained in:
parent
1b3acc85f7
commit
b997e28e57
1 changed files with 10 additions and 3 deletions
|
@ -315,9 +315,16 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
||||||
mPackages.push_back(package->clone());
|
mPackages.push_back(package->clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
// To account for the rare case where AiPackage::execute() queued another AI package
|
// The active package is typically the first entry, this is however not always the case
|
||||||
// (e.g. AiPursue executing a dialogue script that uses startCombat)
|
// e.g. AiPursue executing a dialogue script that uses startCombat adds a combat package to the front
|
||||||
erase(mPackages.begin());
|
// due to the priority.
|
||||||
|
auto activePackageIt = std::find_if(mPackages.begin(), mPackages.end(), [&](auto& entry)
|
||||||
|
{
|
||||||
|
return entry.get() == package;
|
||||||
|
});
|
||||||
|
|
||||||
|
erase(activePackageIt);
|
||||||
|
|
||||||
if (isActualAiPackage(packageTypeId))
|
if (isActualAiPackage(packageTypeId))
|
||||||
mDone = true;
|
mDone = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue