forked from 0ad/0ad
prevent short pathfinder to go into impassable region, fixes #3785
This was SVN commit r17765.
This commit is contained in:
parent
a9376eeebb
commit
41d7e64271
@ -656,7 +656,7 @@ void CCmpPathfinder::ComputeShortPath(const IObstructionTestFilter& filter,
|
|||||||
|
|
||||||
if (i >= staticShapesNb)
|
if (i >= staticShapesNb)
|
||||||
pathfindClearance = clearance - entity_pos_t::FromInt(1)/2;
|
pathfindClearance = clearance - entity_pos_t::FromInt(1)/2;
|
||||||
|
|
||||||
// Expand the vertexes by the moving unit's collision radius, to find the
|
// Expand the vertexes by the moving unit's collision radius, to find the
|
||||||
// closest we can get to it
|
// closest we can get to it
|
||||||
|
|
||||||
@ -838,6 +838,11 @@ void CCmpPathfinder::ComputeShortPath(const IObstructionTestFilter& filter,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
npos = vertexes[n].p;
|
npos = vertexes[n].p;
|
||||||
|
// Prevent cases where a path along an obstruction will end up in an impassable region
|
||||||
|
u16 i, j;
|
||||||
|
Pathfinding::NearestNavcell(npos.X, npos.Y, i, j, m_Grid->m_W, m_Grid->m_H);
|
||||||
|
if (!IS_PASSABLE(m_Grid->get(i, j), passClass))
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Work out which quadrant(s) we're approaching the new vertex from
|
// Work out which quadrant(s) we're approaching the new vertex from
|
||||||
@ -853,9 +858,7 @@ void CCmpPathfinder::ComputeShortPath(const IObstructionTestFilter& filter,
|
|||||||
// Hack: Always head towards the goal if possible, to avoid missing it if it's
|
// Hack: Always head towards the goal if possible, to avoid missing it if it's
|
||||||
// inside another unit
|
// inside another unit
|
||||||
if (n != GOAL_VERTEX_ID)
|
if (n != GOAL_VERTEX_ID)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visible =
|
bool visible =
|
||||||
|
Loading…
Reference in New Issue
Block a user