mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 15:40:32 +00:00
Merge branch 'fix-6633' into 'master'
Fix #6633: AiSequence packages being removed incorrectly Closes #6633 See merge request OpenMW/openmw!1678
This commit is contained in:
commit
85c0d93274
@ -315,9 +315,16 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
||||
mPackages.push_back(package->clone());
|
||||
}
|
||||
|
||||
// To account for the rare case where AiPackage::execute() queued another AI package
|
||||
// (e.g. AiPursue executing a dialogue script that uses startCombat)
|
||||
erase(mPackages.begin());
|
||||
// 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 adds a combat package to the front
|
||||
// due to the priority.
|
||||
auto activePackageIt = std::find_if(mPackages.begin(), mPackages.end(), [&](auto& entry)
|
||||
{
|
||||
return entry.get() == package;
|
||||
});
|
||||
|
||||
erase(activePackageIt);
|
||||
|
||||
if (isActualAiPackage(packageTypeId))
|
||||
mDone = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user