Commit 03f7003c authored by Maciej Suminski's avatar Maciej Suminski
Browse files

pcbnew: Unconnected items share the same NETINFO_ITEM, even if on different boards.

parent 30c7821b
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -1214,9 +1214,11 @@ NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const
    // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
    // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
    // zero is reserved for "no connection" and is not used.
    // zero is reserved for "no connection" and is not used.
    // NULL is returned for non valid netcodes
    // NULL is returned for non valid netcodes
    NETINFO_ITEM* net = m_NetInfo.GetNetItem( aNetcode );


    return net;
    if( aNetcode == NETINFO_LIST::UNCONNECTED )
        return &NETINFO_LIST::ORPHANED;
    else
        return m_NetInfo.GetNetItem( aNetcode );
}
}




+1 −9
Original line number Original line Diff line number Diff line
@@ -53,20 +53,12 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem )
void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode )
void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode )
{
{
    BOARD* board = GetBoard();
    BOARD* board = GetBoard();

    if( board )
    if( board )
    {
        m_netinfo = board->FindNet( aNetCode );
        m_netinfo = board->FindNet( aNetCode );

        // The requested net does not exist, mark it as unconnected
        if( m_netinfo == NULL )
            m_netinfo = board->FindNet( NETINFO_LIST::UNCONNECTED );
    }
    else
    else
    {
        // There is no board that contains list of nets, the item is orphaned
        m_netinfo = &NETINFO_LIST::ORPHANED;
        m_netinfo = &NETINFO_LIST::ORPHANED;
}
}
}




int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const