Reset KIIDs when appending a board.

Fixes https://gitlab.com/kicad/code/kicad/issues/5081
This commit is contained in:
Jeff Young 2020-08-05 19:00:36 +01:00
parent ea71d9db81
commit 04e57a31eb
2 changed files with 16 additions and 13 deletions

View File

@ -2165,7 +2165,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
case T_tstamp:
NextTok();
const_cast<KIID&>( segment->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( segment->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
break;
case T_status:
@ -2245,7 +2245,7 @@ TEXTE_PCB* PCB_PARSER::parseTEXTE_PCB()
case T_tstamp:
NextTok();
const_cast<KIID&>( text->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( text->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;
@ -2297,7 +2297,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
case T_tstamp:
NextTok();
const_cast<KIID&>( dimension->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( dimension->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;
@ -2516,7 +2516,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
case T_tstamp:
NextTok();
const_cast<KIID&>( module->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( module->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;
@ -2811,7 +2811,7 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE()
case T_tstamp:
NextTok();
const_cast<KIID&>( text->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( text->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;
@ -3001,7 +3001,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
case T_tstamp:
NextTok();
const_cast<KIID&>( segment->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( segment->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
break;
case T_status:
@ -3465,7 +3465,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
case T_tstamp:
NextTok();
const_cast<KIID&>( pad->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( pad->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;
@ -3604,7 +3604,7 @@ ARC* PCB_PARSER::parseARC()
case T_tstamp:
NextTok();
const_cast<KIID&>( arc->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( arc->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
break;
case T_status:
@ -3671,7 +3671,7 @@ TRACK* PCB_PARSER::parseTRACK()
case T_tstamp:
NextTok();
const_cast<KIID&>( track->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( track->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
break;
case T_status:
@ -3755,7 +3755,7 @@ VIA* PCB_PARSER::parseVIA()
case T_tstamp:
NextTok();
const_cast<KIID&>( via->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( via->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;
@ -3844,7 +3844,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
case T_tstamp:
NextTok();
const_cast<KIID&>( zone->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( zone->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;
@ -4374,7 +4374,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET()
case T_tstamp:
NextTok();
const_cast<KIID&>( target->m_Uuid ) = KIID( CurStr() );
const_cast<KIID&>( target->m_Uuid ) = m_resetKIIDs ? KIID() : KIID( CurStr() );
NeedRIGHT();
break;

View File

@ -78,6 +78,7 @@ class PCB_PARSER : public PCB_LEXER
std::vector<int> m_netCodes; ///< net codes mapping for boards being loaded
bool m_tooRecent; ///< true if version parses as later than supported
int m_requiredVersion; ///< set to the KiCad format version this board requires
bool m_resetKIIDs; ///< reading into an existing board; reset UUIDs
bool m_showLegacyZoneWarning;
@ -319,7 +320,8 @@ public:
PCB_PARSER( LINE_READER* aReader = NULL ) :
PCB_LEXER( aReader ),
m_board( 0 )
m_board( 0 ),
m_resetKIIDs( false )
{
init();
}
@ -343,6 +345,7 @@ public:
{
init();
m_board = aBoard;
m_resetKIIDs = true;
}
BOARD_ITEM* Parse();