Better logic for footprint loop.
Fixes: lp:1795288 * https://bugs.launchpad.net/kicad/+bug/1795288
This commit is contained in:
parent
dfe164e0dc
commit
afd518d1e8
|
@ -2560,6 +2560,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
|||
{
|
||||
COMPONENT* component = aNetlist.GetComponent( i );
|
||||
int matchCount = 0;
|
||||
MODULE* tmp;
|
||||
|
||||
msg.Printf( _( "Checking netlist symbol footprint \"%s:%s:%s\"." ),
|
||||
component->GetReference(),
|
||||
|
@ -2567,20 +2568,14 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
|||
GetChars( component->GetFPID().Format() ) );
|
||||
aReporter.Report( msg, REPORTER::RPT_INFO );
|
||||
|
||||
// This loop must be executed at least once to add new footprints even
|
||||
// if the board has no existing footprints:
|
||||
for( MODULE* footprint = m_Modules; ; footprint = footprint->Next() )
|
||||
for( MODULE* footprint = m_Modules; footprint; footprint = footprint->Next() )
|
||||
{
|
||||
bool match = false;
|
||||
MODULE* tmp;
|
||||
bool match;
|
||||
|
||||
if( footprint )
|
||||
{
|
||||
if( aNetlist.IsFindByTimeStamp() )
|
||||
match = footprint->GetPath() == component->GetTimeStamp();
|
||||
else
|
||||
match = footprint->GetReference().CmpNoCase( component->GetReference() );
|
||||
}
|
||||
|
||||
if( match )
|
||||
{
|
||||
|
@ -2688,6 +2683,11 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
|||
|
||||
if( footprint == lastPreexistingFootprint )
|
||||
{
|
||||
// No sense going through the newly-created footprints: end loop
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( matchCount == 0 )
|
||||
{
|
||||
if( component->GetModule() != NULL )
|
||||
|
@ -2718,16 +2718,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
|||
|
||||
updateComponentPadConnections( aNetlist, tmp, component, aReporter );
|
||||
}
|
||||
|
||||
matchCount++;
|
||||
}
|
||||
|
||||
// No sense going through the newly-created footprints: end loop
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( matchCount > 1 )
|
||||
else if( matchCount > 1 )
|
||||
{
|
||||
msg.Printf( _( "Multiple footprints found for \"%s\"." ), component->GetReference() );
|
||||
aReporter.Report( msg, REPORTER::RPT_ERROR );
|
||||
|
|
Loading…
Reference in New Issue