Split functions to remove redundant clearPath argument

pull/578/head
elsid 5 years ago
parent b8513e0318
commit 131f2557b1
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -89,6 +89,11 @@ namespace MWMechanics
const auto maxHalfExtent = std::max(halfExtents.x(), std::max(halfExtents.y(), halfExtents.z()));
return world->isAreaOccupiedByOtherActor(destination, 2 * maxHalfExtent, actor);
}
void stopMovement(const MWWorld::Ptr& actor)
{
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
}
}
AiWander::AiWander(int distance, int duration, int timeOfDay, const std::vector<unsigned char>& idle, bool repeat):
@ -206,7 +211,7 @@ namespace MWMechanics
{
if (storage.mState == AiWanderStorage::Wander_Walking)
{
stopWalking(actor, false);
stopMovement(actor);
mObstacleCheck.clear();
storage.setState(AiWanderStorage::Wander_IdleNow);
}
@ -609,14 +614,11 @@ namespace MWMechanics
return TypeIdWander;
}
void AiWander::stopWalking(const MWWorld::Ptr& actor, bool clearPath)
void AiWander::stopWalking(const MWWorld::Ptr& actor)
{
if (clearPath)
{
mPathFinder.clearPath();
mHasDestination = false;
}
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
mPathFinder.clearPath();
mHasDestination = false;
stopMovement(actor);
}
bool AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect)

@ -118,7 +118,7 @@ namespace MWMechanics
private:
// NOTE: mDistance and mDuration must be set already
void init();
void stopWalking(const MWWorld::Ptr& actor, bool clearPath = true);
void stopWalking(const MWWorld::Ptr& actor);
/// Have the given actor play an idle animation
/// @return Success or error

Loading…
Cancel
Save