Improve clarity.

This commit is contained in:
Jeff Young 2023-09-30 23:59:25 +01:00
parent efd004b042
commit b18fd12694
1 changed files with 10 additions and 6 deletions

View File

@ -345,6 +345,7 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint,
} }
nlohmann::ordered_map<wxString, wxString> fpFieldsAsMap; nlohmann::ordered_map<wxString, wxString> fpFieldsAsMap;
for( PCB_FIELD* field : aPcbFootprint->GetFields() ) for( PCB_FIELD* field : aPcbFootprint->GetFields() )
{ {
// These fields are individually checked above, and are not currently present in (fields) anyway. // These fields are individually checked above, and are not currently present in (fields) anyway.
@ -367,16 +368,19 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint,
changed = true; changed = true;
// Add or change field value // Add or change field value
for( auto pair : aNetlistComponent->GetFields() ) for( auto& [ name, value ] : aNetlistComponent->GetFields() )
{ {
if( aPcbFootprint->HasFieldByName( pair.first ) ) if( aPcbFootprint->HasFieldByName( name ) )
aPcbFootprint->GetFieldByName( pair.first )->SetText( pair.second ); {
aPcbFootprint->GetFieldByName( name )->SetText( value );
}
else else
{ {
PCB_FIELD* newField = aPcbFootprint->AddField( PCB_FIELD( int idx = aPcbFootprint->GetFieldCount();
aPcbFootprint, aPcbFootprint->GetFieldCount(), pair.first ) ); PCB_FIELD* newField = aPcbFootprint->AddField( PCB_FIELD( aPcbFootprint, idx ) );
newField->SetText( pair.second ); newField->SetName( name );
newField->SetText( value );
newField->SetVisible( false ); newField->SetVisible( false );
newField->SetLayer( aPcbFootprint->GetLayer() == F_Cu ? F_Fab : B_Fab ); newField->SetLayer( aPcbFootprint->GetLayer() == F_Cu ? F_Fab : B_Fab );