1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Make AiWander::isPackageCompleted const

This commit is contained in:
elsid 2020-05-16 14:58:50 +02:00
parent 131f2557b1
commit 256c9917a4
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40
2 changed files with 6 additions and 14 deletions

View File

@ -235,8 +235,9 @@ namespace MWMechanics
if (mDistance <= 0)
storage.mCanWanderAlongPathGrid = false;
if (isPackageCompleted(actor))
if (isPackageCompleted())
{
stopWalking(actor);
// Reset package so it can be used again
mRemainingDuration=mDuration;
init();
@ -320,19 +321,10 @@ namespace MWMechanics
return actor.getRefData().getPosition().asVec3();
}
bool AiWander::isPackageCompleted(const MWWorld::Ptr& actor)
bool AiWander::isPackageCompleted() const
{
if (mDuration)
{
// End package if duration is complete
if (mRemainingDuration <= 0)
{
stopWalking(actor);
return true;
}
}
// if get here, not yet completed
return false;
// End package if duration is complete
return mDuration && mRemainingDuration <= 0;
}
/*

View File

@ -133,7 +133,7 @@ namespace MWMechanics
void onWalkingStatePerFrameActions(const MWWorld::Ptr& actor, float duration, AiWanderStorage& storage);
void onChooseActionStatePerFrameActions(const MWWorld::Ptr& actor, AiWanderStorage& storage);
bool reactionTimeActions(const MWWorld::Ptr& actor, AiWanderStorage& storage, ESM::Position& pos);
bool isPackageCompleted(const MWWorld::Ptr& actor);
inline bool isPackageCompleted() const;
void wanderNearStart(const MWWorld::Ptr &actor, AiWanderStorage &storage, int wanderDistance);
bool destinationIsAtWater(const MWWorld::Ptr &actor, const osg::Vec3f& destination);
void completeManualWalking(const MWWorld::Ptr &actor, AiWanderStorage &storage);