A little more safety in setting the router idle mode.

Fixes https://gitlab.com/kicad/code/kicad/issues/8765
This commit is contained in:
Jeff Young 2021-07-09 10:25:19 +01:00
parent 00f1b609c4
commit 2bd735b631
2 changed files with 17 additions and 31 deletions

View File

@ -188,6 +188,7 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
if( m_dragger->Start( aP, aStartItems ) )
{
m_state = DRAG_SEGMENT;
return true;
}
else
{
@ -195,8 +196,6 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
m_state = IDLE;
return false;
}
return true;
}
@ -412,21 +411,21 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
m_logger->Log( LOGGER::EVT_START_ROUTE, aP, aStartItem );
}
bool rv = m_placer->Start( aP, aStartItem );
if( !rv )
if( m_placer->Start( aP, aStartItem ) )
{
m_state = ROUTE_TRACK;
return true;
}
else
{
m_state = IDLE;
return false;
m_currentEnd = aP;
m_state = ROUTE_TRACK;
return rv;
}
}
void ROUTER::Move( const VECTOR2I& aP, ITEM* endItem )
{
m_currentEnd = aP;
if( m_logger )
m_logger->Log( LOGGER::EVT_MOVE, aP, endItem );

View File

@ -166,10 +166,7 @@ public:
LOGGER* Logger();
RULE_RESOLVER* GetRuleResolver() const
{
return m_iface->GetRuleResolver();
}
RULE_RESOLVER* GetRuleResolver() const { return m_iface->GetRuleResolver(); }
bool IsPlacingVia() const;
@ -207,20 +204,10 @@ public:
PLACEMENT_ALGO* Placer() { return m_placer.get(); }
ROUTER_IFACE* GetInterface() const
{
return m_iface;
}
ROUTER_IFACE* GetInterface() const { return m_iface; }
void SetVisibleViewArea( const BOX2I& aExtents )
{
m_visibleViewArea = aExtents;
}
const BOX2I& VisibleViewArea() const
{
return m_visibleViewArea;
}
void SetVisibleViewArea( const BOX2I& aExtents ) { m_visibleViewArea = aExtents; }
const BOX2I& VisibleViewArea() const { return m_visibleViewArea; }
private:
void movePlacing( const VECTOR2I& aP, ITEM* aItem );
@ -233,9 +220,9 @@ private:
void markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR& aRemoved );
bool isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aItem, int aLayer );
BOX2I m_visibleViewArea;
VECTOR2I m_currentEnd;
RouterState m_state;
private:
BOX2I m_visibleViewArea;
RouterState m_state;
std::unique_ptr<NODE> m_world;
NODE* m_lastNode;