1
0
forked from 0ad/0ad

Don't try to short-path to non-point goals, because the algorithm won't deal with connectivity. Fixes another bug reported in #3363.

This was SVN commit r16985.
This commit is contained in:
Nicolas Auvray 2015-09-04 20:43:05 +00:00
parent 2a7dc39d07
commit 1d89d05956

View File

@ -1341,10 +1341,12 @@ void CCmpUnitMotion::BeginPathing(const CFixedVector2D& from, const PathGoal& go
// Otherwise we need to compute a path.
// If it's close then just do a short path, not a long path
// If it's close then just do a short path, not a long path.
// We should always do long paths to non-goal points because the most
// accessible point has to be computed by the hierarchical pathfinder.
// TODO: If it's close on the opposite side of a river then we really
// need a long path, so we shouldn't simply check linear distance
if (goal.DistanceToPoint(from) < SHORT_PATH_SEARCH_RANGE)
if (goal.DistanceToPoint(from) < SHORT_PATH_SEARCH_RANGE && goal.type == PathGoal::POINT)
{
m_LongPath.m_Waypoints.clear();
m_PathState = PATHSTATE_WAITING_REQUESTING_SHORT;