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? // Are we there yet?
bool& chooseAction = storage.mChooseAction; bool& chooseAction = storage.mChooseAction;
if(walking && 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); stopWalking(actor, storage);
moveNow = false; moveNow = false;

@ -297,13 +297,13 @@ namespace MWMechanics
return false; 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()) if(mPath.empty())
return true; return true;
ESM::Pathgrid::Point nextPoint = *mPath.begin(); 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(); mPath.pop_front();
if(mPath.empty()) if(mPath.empty())

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

Loading…
Cancel
Save