diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index c9fc2bf91a..322cd33c4d 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -163,12 +163,14 @@ bool PNS_DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& } -bool PNS_DIFF_PAIR_PLACER::attemptWalk ( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent, PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly ) +bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent, + PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly ) { PNS_WALKAROUND walkaround( aNode, Router() ); PNS_WALKAROUND::WALKAROUND_STATUS wf1; - Router()->GetClearanceFunc()->OverrideClearance( true, aCurrent->NetP(), aCurrent->NetN(), aCurrent->Gap() ); + Router()->GetClearanceFunc()->OverrideClearance( true, + aCurrent->NetP(), aCurrent->NetN(), aCurrent->Gap() ); walkaround.SetSolidsOnly( aSolidsOnly ); walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() ); @@ -247,21 +249,21 @@ bool PNS_DIFF_PAIR_PLACER::tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, boo PNS_DIFF_PAIR best; double bestScore = 100000000000000.0; - for( int attempt = 0; attempt <= 1; attempt++ ) + for( int attempt = 0; attempt <= 3; attempt++ ) { PNS_DIFF_PAIR p; PNS_NODE *tmp = m_currentNode->Branch(); - bool pfirst = attempt % 2 ? true : false; - bool wind_cw = attempt / 2 ? true : false; + bool pfirst = ( attempt & 1 ) ? true : false; + bool wind_cw = ( attempt & 2 ) ? true : false; - if( attemptWalk ( tmp, &aPair, p, pfirst, wind_cw, aSolidsOnly ) ) + if( attemptWalk( tmp, &aPair, p, pfirst, wind_cw, aSolidsOnly ) ) { // double len = p.TotalLength(); double cl = p.CoupledLength(); double skew = p.Skew(); - double score = cl + fabs(skew) * 3.0; + double score = cl + fabs( skew ) * 3.0; if( score < bestScore ) { diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 39d5f5cd31..9e50260eb3 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -580,8 +580,8 @@ void PNS_LINE::DragSegment ( const VECTOR2I& aP, int aIndex, int aSnappingThresh s_next = path.CSegment( index + 1 ); dragged = path.CSegment( index ); - bool lockEndpointA = true; - bool lockEndpointB = true; + const bool lockEndpointA = true; + const bool lockEndpointB = true; if( aIndex == 0 ) { diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index d18933f491..57b8a0e8d0 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -386,6 +386,7 @@ bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache ) return static_cast( m_world->CheckColliding( aItem ) ); +#if 0 // something is wrong with the cache, need to investigate. m_cache.Query( aItem->Shape(), m_world->GetMaxClearance(), v, false ); @@ -408,6 +409,7 @@ bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache ) } return false; +#endif } diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 512434a944..c9df5c025c 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -876,7 +876,8 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) const SELECTION& selection = selTool->GetSelection(); // pick up items under the cursor if needed - hoverSelection( selection ); + if( !hoverSelection( selection ) ) + return 0; // we have a selection to work on now, so start the tool process