1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 03:40:14 +00:00

Increment iterator before fast forward

When player is located in the exterior cell AiTravel::fastForward may move
another actor into a cell outside active grid. This will remove the actor from
MWMechanics::Actors::mActors which invalidates current iterator in the
Actors::fastForwardAi loop.
This commit is contained in:
elsid 2022-05-27 13:31:58 +02:00
parent a5201ac443
commit bf76faeb2d
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

View File

@ -2249,9 +2249,10 @@ namespace MWMechanics
if (!MWBase::Environment::get().getMechanicsManager()->isAIActive())
return;
for (const Actor& actor : mActors)
for (auto it = mActors.begin(); it != mActors.end();)
{
const MWWorld::Ptr ptr = actor.getPtr();
const MWWorld::Ptr ptr = it->getPtr();
++it;
if (ptr == getPlayer()
|| !isConscious(ptr)
|| ptr.getClass().getCreatureStats(ptr).isParalyzed())