Make sure segments read from file are in correct order.
Fixes: lp:1752033 * https://bugs.launchpad.net/kicad/+bug/1752033
This commit is contained in:
parent
7943372e8b
commit
2e4f50f206
|
@ -498,15 +498,18 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
|
|
||||||
if( Type() == PCB_ZONE_T )
|
// When reading from a file most of the items will already be in the correct order.
|
||||||
track = aPcb->m_Zone;
|
// Searching from the back therefore takes us from n^2 to essentially 0.
|
||||||
else
|
|
||||||
track = aPcb->m_Track;
|
|
||||||
|
|
||||||
for( ; track; track = track->Next() )
|
if( Type() == PCB_ZONE_T )
|
||||||
|
track = aPcb->m_Zone.GetLast();
|
||||||
|
else
|
||||||
|
track = aPcb->m_Track.GetLast();
|
||||||
|
|
||||||
|
for( ; track; track = track->Back() )
|
||||||
{
|
{
|
||||||
if( GetNetCode() <= track->GetNetCode() )
|
if( GetNetCode() >= track->GetNetCode() )
|
||||||
return track;
|
return track->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -558,11 +558,11 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_segment:
|
case T_segment:
|
||||||
m_board->Add( parseTRACK(), ADD_APPEND );
|
m_board->Add( parseTRACK(), ADD_INSERT );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_via:
|
case T_via:
|
||||||
m_board->Add( parseVIA(), ADD_APPEND );
|
m_board->Add( parseVIA(), ADD_INSERT );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_zone:
|
case T_zone:
|
||||||
|
|
Loading…
Reference in New Issue