1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Add walk and swim flags when corresponding speed is positive

This allows to avoid finding path over area that will should have infinite
cost (area_cost = area_cost_factor / area_speed).
This commit is contained in:
elsid 2021-04-13 23:23:45 +02:00
parent 3c4a9069ae
commit 0fae6d9a0a
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40

View file

@ -424,14 +424,15 @@ DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld::
const MWWorld::Class& actorClass = actor.getClass();
DetourNavigator::Flags result = DetourNavigator::Flag_none;
if (actorClass.isPureWaterCreature(actor)
if ((actorClass.isPureWaterCreature(actor)
|| (getTypeId() != AiPackageTypeId::Wander
&& ((allowToFollowOverWaterSurface && getTypeId() == AiPackageTypeId::Follow)
|| actorClass.canSwim(actor)
|| hasWaterWalking(actor))))
|| hasWaterWalking(actor)))
) && actorClass.getSwimSpeed(actor) > 0)
result |= DetourNavigator::Flag_swim;
if (actorClass.canWalk(actor))
if (actorClass.canWalk(actor) && actor.getClass().getWalkSpeed(actor) > 0)
result |= DetourNavigator::Flag_walk;
if (actorClass.isBipedal(actor) && getTypeId() != AiPackageTypeId::Wander)