Reduce default pathing arrival tolerance to 32 units (Fixes #1605)

This commit is contained in:
scrawl 2015-01-06 22:19:04 +01:00
parent e19ab77d00
commit 4d9100091d
3 changed files with 5 additions and 5 deletions

View file

@ -202,7 +202,7 @@ namespace MWMechanics
// Are we there yet?
bool& chooseAction = storage.mChooseAction;
if(walking &&
storage.mPathFinder.checkPathCompleted(pos.pos[0], pos.pos[1], pos.pos[2]))
storage.mPathFinder.checkPathCompleted(pos.pos[0], pos.pos[1], pos.pos[2], 64.f))
{
stopWalking(actor, storage);
moveNow = false;

View file

@ -297,13 +297,13 @@ namespace MWMechanics
return false;
}
bool PathFinder::checkPathCompleted(float x, float y, float z)
bool PathFinder::checkPathCompleted(float x, float y, float z, float tolerance)
{
if(mPath.empty())
return true;
ESM::Pathgrid::Point nextPoint = *mPath.begin();
if(sqrDistanceZCorrected(nextPoint, x, y, z) < 64*64)
if(sqrDistanceZCorrected(nextPoint, x, y, z) < tolerance*tolerance)
{
mPath.pop_front();
if(mPath.empty())

View file

@ -39,8 +39,8 @@ namespace MWMechanics
void buildPath(const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint,
const MWWorld::CellStore* cell, bool allowShortcuts = true);
bool checkPathCompleted(float x, float y, float z);
///< \Returns true if the last point of the path has been reached.
bool checkPathCompleted(float x, float y, float z, float tolerance=32.f);
///< \Returns true if we are within \a tolerance units of the last path point.
bool checkWaypoint(float x, float y, float z);
///< \Returns true if a way point was reached