mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 13:09:42 +00:00
Check whether can actor move along z-axis in separate function
This commit is contained in:
parent
bbd82a743a
commit
92b34e8bb4
2 changed files with 10 additions and 6 deletions
|
@ -129,12 +129,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
|||
|
||||
const bool wasShortcutting = mIsShortcutting;
|
||||
bool destInLOS = false;
|
||||
|
||||
const MWWorld::Class& actorClass = actor.getClass();
|
||||
|
||||
// check if actor can move along z-axis
|
||||
bool actorCanMoveByZ = (actorClass.canSwim(actor) && world->isSwimming(actor))
|
||||
|| world->isFlying(actor);
|
||||
const bool actorCanMoveByZ = canActorMoveByZAxis(actor);
|
||||
|
||||
// Prohibit shortcuts for AiWander, if the actor can not move in 3 dimensions.
|
||||
if (actorCanMoveByZ)
|
||||
|
@ -418,3 +413,10 @@ DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld::
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MWMechanics::AiPackage::canActorMoveByZAxis(const MWWorld::Ptr& actor) const
|
||||
{
|
||||
const auto world = MWBase::Environment::get().getWorld();
|
||||
const auto& actorClass = actor.getClass();
|
||||
return (actorClass.canSwim(actor) && world->isSwimming(actor)) || world->isFlying(actor);
|
||||
}
|
||||
|
|
|
@ -134,6 +134,8 @@ namespace MWMechanics
|
|||
|
||||
DetourNavigator::Flags getNavigatorFlags(const MWWorld::Ptr& actor) const;
|
||||
|
||||
bool canActorMoveByZAxis(const MWWorld::Ptr& actor) const;
|
||||
|
||||
// TODO: all this does not belong here, move into temporary storage
|
||||
PathFinder mPathFinder;
|
||||
ObstacleCheck mObstacleCheck;
|
||||
|
|
Loading…
Reference in a new issue