Adjust LIB_SYMBOL compare for use with ERC.
Fixes https://gitlab.com/kicad/code/kicad/issues/10783
(cherry picked from commit 117bd4fc22
)
This commit is contained in:
parent
03bc9551c7
commit
63ce2307c8
|
@ -214,7 +214,11 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags ) const
|
||||||
if( m_me == aRhs.m_me )
|
if( m_me == aRhs.m_me )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int retv = m_name.Cmp( aRhs.m_name );
|
int retv = 0;
|
||||||
|
|
||||||
|
if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 )
|
||||||
|
{
|
||||||
|
retv = m_name.Cmp( aRhs.m_name );
|
||||||
|
|
||||||
if( retv )
|
if( retv )
|
||||||
return retv;
|
return retv;
|
||||||
|
@ -223,6 +227,7 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags ) const
|
||||||
|
|
||||||
if( retv )
|
if( retv )
|
||||||
return retv;
|
return retv;
|
||||||
|
}
|
||||||
|
|
||||||
if( m_parent.lock() < aRhs.m_parent.lock() )
|
if( m_parent.lock() < aRhs.m_parent.lock() )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -258,9 +263,16 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags ) const
|
||||||
{
|
{
|
||||||
const LIB_FIELD* lhsField = static_cast<const LIB_FIELD*>( lhsItem );
|
const LIB_FIELD* lhsField = static_cast<const LIB_FIELD*>( lhsItem );
|
||||||
|
|
||||||
if( lhsField->IsMandatory() )
|
if( lhsField->GetId() == VALUE_FIELD )
|
||||||
|
{
|
||||||
|
if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 || IsPower() )
|
||||||
retv = lhsItem->compare( *rhsItem, aCompareFlags );
|
retv = lhsItem->compare( *rhsItem, aCompareFlags );
|
||||||
}
|
}
|
||||||
|
else if( lhsField->IsMandatory() )
|
||||||
|
{
|
||||||
|
retv = lhsItem->compare( *rhsItem, aCompareFlags );
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retv = lhsItem->compare( *rhsItem, aCompareFlags );
|
retv = lhsItem->compare( *rhsItem, aCompareFlags );
|
||||||
|
|
Loading…
Reference in New Issue