From 7b1702b5fb4c6e3628684542e2e0afb7e3b40ded Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 18 Nov 2022 06:29:51 -0800 Subject: [PATCH] Use IsType() for selection testing Straight Type() comparison breaks for the TYPE_LOCATE values --- common/tool/selection.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/common/tool/selection.cpp b/common/tool/selection.cpp index d44360a1d0..535d8030a0 100644 --- a/common/tool/selection.cpp +++ b/common/tool/selection.cpp @@ -135,7 +135,7 @@ bool SELECTION::HasType( KICAD_T aType ) const { for( const EDA_ITEM* item : m_items ) { - if( item->Type() == aType ) + if( item->IsType( { aType } ) ) return true; } @@ -149,7 +149,7 @@ size_t SELECTION::CountType( KICAD_T aType ) const for( const EDA_ITEM* item : m_items ) { - if( item->Type() == aType ) + if( item->IsType( { aType } ) ) count++; } @@ -183,18 +183,7 @@ bool SELECTION::OnlyContains( std::vector aList ) const return ( std::all_of( m_items.begin(), m_items.end(), [&]( const EDA_ITEM* r ) { - bool ok = false; - - for( const KICAD_T& type : aList ) - { - if( r->Type() == type ) - { - ok = true; - break; - } - } - - return ok; + return r->IsType( aList ); } ) ); }