1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-26 06:40:22 +00:00

Merge pull request #2851 from elsid/fix_aiwander_crash

Fix AiWander crash
This commit is contained in:
Bret Curtis 2020-05-16 18:34:02 +02:00 committed by GitHub
commit a4f29a8e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -276,8 +276,7 @@ namespace MWMechanics
completeManualWalking(actor, storage);
}
AiWanderStorage::WanderState& wanderState = storage.mState;
if ((wanderState == AiWanderStorage::Wander_MoveNow) && storage.mCanWanderAlongPathGrid)
if (storage.mState == AiWanderStorage::Wander_MoveNow && storage.mCanWanderAlongPathGrid)
{
// Construct a new path if there isn't one
if(!mPathFinder.isPathConstructed())
@ -293,8 +292,10 @@ namespace MWMechanics
completeManualWalking(actor, storage);
}
if (wanderState == AiWanderStorage::Wander_Walking
&& (isDestinationHidden(actor, mPathFinder.getPath().back())
if (storage.mIsWanderingManually
&& storage.mState == AiWanderStorage::Wander_Walking
&& (mPathFinder.getPathSize() == 0
|| isDestinationHidden(actor, mPathFinder.getPath().back())
|| isAreaOccupiedByOtherActor(actor, mPathFinder.getPath().back())))
completeManualWalking(actor, storage);