From 400f4ae50699b47a9a5f4ff06378e2aca40d2fc8 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 2 Jul 2021 15:53:49 +0100 Subject: [PATCH] Code cleanup. --- pcbnew/router/router_tool.cpp | 36 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 3d20ade8c2..8890141d61 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -873,20 +873,19 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) viaType = VIATYPE::THROUGH; } - switch( viaType ) + if( targetLayer == UNDEFINED_LAYER ) { - case VIATYPE::THROUGH: - if( targetLayer == UNDEFINED_LAYER ) + // Implicic layer selection + + switch( viaType ) { + case VIATYPE::THROUGH: // use the default layer pair currentLayer = pairTop; targetLayer = pairBottom; - } - break; + break; - case VIATYPE::MICROVIA: - if( targetLayer == UNDEFINED_LAYER ) - { + case VIATYPE::MICROVIA: if( currentLayer == F_Cu || currentLayer == In1_Cu ) { // front-side microvia @@ -901,15 +900,12 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) } else { - wxASSERT_MSG( false, "Invalid implicit layer pair for microvia (must be on or " - "adjacent to an outer layer)." ); + wxFAIL_MSG( "Invalid implicit layer pair for microvia (must be on " + "or adjacent to an outer layer)." ); } - } - break; + break; - case VIATYPE::BLIND_BURIED: - if( targetLayer == UNDEFINED_LAYER ) - { + case VIATYPE::BLIND_BURIED: if( currentLayer == pairTop || currentLayer == pairBottom ) { // the current layer is on the defined layer pair, @@ -923,12 +919,12 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) // so fallback and swap to the top layer of the pair by default targetLayer = pairTop; } - } - break; + break; - default: - wxASSERT( false ); - break; + default: + wxFAIL_MSG( "unexpected via type" ); + break; + } } sizes.SetViaDiameter( bds.m_ViasMinSize );