1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 12:35:46 +00:00

Pathfinding bugfix.

Observed at Ebonheart (coe 1, -13).  Especially at the western tower. Guards try to walk though tower door.
Cause: buildPath() adds destination (even when unreachable) when only using single node from pathgrid.
This commit is contained in:
dteviot 2015-08-30 16:12:51 +12:00
parent f2c9b9351f
commit 39c2ba8efe

View File

@ -225,20 +225,17 @@ namespace MWMechanics
ESM::Pathgrid::Point temp(mPathgrid->mPoints[startNode]);
converter.ToWorld(temp);
mPath.push_back(temp);
mPath.push_back(endPoint);
return;
}
else
{
mPath = mCell->aStarSearch(startNode, endNode.first);
if (mPath.empty())
return;
// convert supplied path to world co-ordinates
for (std::list<ESM::Pathgrid::Point>::iterator iter(mPath.begin()); iter != mPath.end(); ++iter)
{
converter.ToWorld(*iter);
}
}
// If endNode found is NOT the closest PathGrid point to the endPoint,
// assume endPoint is not reachable from endNode. In which case,
@ -254,8 +251,6 @@ namespace MWMechanics
// The AI routines will have to deal with such situations.
if(endNode.second)
mPath.push_back(endPoint);
return;
}
float PathFinder::getZAngleToNext(float x, float y) const