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

openmw-35
scrawl 10 years ago
parent e19ab77d00
commit 4d9100091d

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

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

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

Loading…
Cancel
Save