1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 12:53:51 +00:00

Split functions to remove redundant clearPath argument

This commit is contained in:
elsid 2020-05-16 14:57:20 +02:00
parent b8513e0318
commit 131f2557b1
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
2 changed files with 11 additions and 9 deletions

View file

@ -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)

View file

@ -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