1
0
Fork 0
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:
ζeh Matt 2022-02-19 14:56:51 +02:00
parent 1b3acc85f7
commit b997e28e57
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0

View file

@ -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;
} }