Commit fe341876 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

bugfix #1326155: pcbnew shows strange ratsnest lines in OpenGL mode.

parent 9305f77f
Loading
Loading
Loading
Loading
+4 −17
Original line number Diff line number Diff line
@@ -34,8 +34,6 @@
#include <class_board.h>
#include <class_board_item.h>

#include <ratsnest_data.h>

BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
    BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED ),
    m_Subnet( 0 ), m_ZoneSubnet( 0 )
@@ -55,29 +53,18 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem )
void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode )
{
    BOARD* board = GetBoard();
    NETINFO_ITEM* oldNetInfo = m_netinfo;
    NETINFO_ITEM* newNetInfo;

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

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

    // Update ratsnest, if necessary
    if( oldNetInfo != newNetInfo && board )
    {
        board->GetRatsnest()->Remove( this );
        m_netinfo = newNetInfo;
        board->GetRatsnest()->Add( this );
        m_netinfo = &NETINFO_LIST::ORPHANED;
    }
}