forked from mirror/openmw-tes3mp
removed unnecessary tests.
This commit is contained in:
parent
5aeabe22f0
commit
5049c9ab6a
1 changed files with 16 additions and 16 deletions
|
@ -25,8 +25,7 @@ namespace
|
||||||
//
|
//
|
||||||
int getClosestPoint(const ESM::Pathgrid* grid, const osg::Vec3f& pos)
|
int getClosestPoint(const ESM::Pathgrid* grid, const osg::Vec3f& pos)
|
||||||
{
|
{
|
||||||
if(!grid || grid->mPoints.empty())
|
assert(grid && !grid->mPoints.empty());
|
||||||
return -1;
|
|
||||||
|
|
||||||
float distanceBetween = distanceSquared(grid->mPoints[0], pos);
|
float distanceBetween = distanceSquared(grid->mPoints[0], pos);
|
||||||
int closestIndex = 0;
|
int closestIndex = 0;
|
||||||
|
@ -228,21 +227,22 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
mPath = mCell->aStarSearch(startNode, endNode.first);
|
mPath = mCell->aStarSearch(startNode, endNode.first);
|
||||||
|
assert(!mPath.empty());
|
||||||
|
|
||||||
if(!mPath.empty())
|
// If endNode found is NOT the closest PathGrid point to the endPoint,
|
||||||
{
|
// assume endPoint is not reachable from endNode. In which case,
|
||||||
// Add the destination (which may be different to the closest
|
// path ends at endNode.
|
||||||
// pathgrid point). However only add if endNode was the closest
|
//
|
||||||
// point to endPoint.
|
// So only add the destination (which may be different to the closest
|
||||||
//
|
// pathgrid point) when endNode was the closest point to endPoint.
|
||||||
// This logic can fail in the opposite situate, e.g. endPoint may
|
//
|
||||||
// have been reachable but happened to be very close to an
|
// This logic can fail in the opposite situate, e.g. endPoint may
|
||||||
// unreachable pathgrid point.
|
// have been reachable but happened to be very close to an
|
||||||
//
|
// unreachable pathgrid point.
|
||||||
// The AI routines will have to deal with such situations.
|
//
|
||||||
if(endNode.second)
|
// The AI routines will have to deal with such situations.
|
||||||
mPath.push_back(endPoint);
|
if(endNode.second)
|
||||||
}
|
mPath.push_back(endPoint);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue