1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-10 14:06:42 +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); completeManualWalking(actor, storage);
} }
AiWanderStorage::WanderState& wanderState = storage.mState; if (storage.mState == AiWanderStorage::Wander_MoveNow && storage.mCanWanderAlongPathGrid)
if ((wanderState == AiWanderStorage::Wander_MoveNow) && storage.mCanWanderAlongPathGrid)
{ {
// Construct a new path if there isn't one // Construct a new path if there isn't one
if(!mPathFinder.isPathConstructed()) if(!mPathFinder.isPathConstructed())
@ -293,8 +292,10 @@ namespace MWMechanics
completeManualWalking(actor, storage); completeManualWalking(actor, storage);
} }
if (wanderState == AiWanderStorage::Wander_Walking if (storage.mIsWanderingManually
&& (isDestinationHidden(actor, mPathFinder.getPath().back()) && storage.mState == AiWanderStorage::Wander_Walking
&& (mPathFinder.getPathSize() == 0
|| isDestinationHidden(actor, mPathFinder.getPath().back())
|| isAreaOccupiedByOtherActor(actor, mPathFinder.getPath().back()))) || isAreaOccupiedByOtherActor(actor, mPathFinder.getPath().back())))
completeManualWalking(actor, storage); completeManualWalking(actor, storage);