1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-10 03:39:55 +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()) if (!MWBase::Environment::get().getMechanicsManager()->isAIActive())
return; 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() if (ptr == getPlayer()
|| !isConscious(ptr) || !isConscious(ptr)
|| ptr.getClass().getCreatureStats(ptr).isParalyzed()) || ptr.getClass().getCreatureStats(ptr).isParalyzed())