Only compare collision-corrected routes when looking for shortest.

Fixes https://gitlab.com/kicad/code/kicad/issues/6511
This commit is contained in:
Jeff Young 2020-12-19 23:19:38 +00:00
parent c8be87a654
commit 46314f6483
1 changed files with 3 additions and 2 deletions

View File

@ -477,7 +477,8 @@ bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead )
bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead ) bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
{ {
LINE newHead( m_head ), bestHead( m_head ); LINE newHead( m_head );
LINE bestHead( m_head );
bool hasBest = false; bool hasBest = false;
buildInitialLine( aP, newHead ); buildInitialLine( aP, newHead );
@ -503,7 +504,7 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
// We want the shortest line here to ensure we don't break a clearance // We want the shortest line here to ensure we don't break a clearance
// rule on larger, overlapping items (e.g. vias) // rule on larger, overlapping items (e.g. vias)
if( newHead.CLine().Length() < bestHead.CLine().Length() ) if( !hasBest || newHead.CLine().Length() < bestHead.CLine().Length() )
{ {
bestHead = newHead; bestHead = newHead;
hasBest = true; hasBest = true;