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:
parent
a5201ac443
commit
bf76faeb2d
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user