router: Limit the amount of move attempts in ROUTER::Finish
Otherwise auto-finish hangs in some cases.
This commit is contained in:
parent
b15913bd53
commit
82874daf08
|
@ -540,13 +540,16 @@ bool ROUTER::Finish()
|
||||||
if( !getNearestRatnestAnchor( otherEnd, otherEndLayers ) )
|
if( !getNearestRatnestAnchor( otherEnd, otherEndLayers ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Keep moving until we don't change position
|
// Keep moving until we don't change position or hit the limit
|
||||||
|
int triesLeft = 5;
|
||||||
VECTOR2I moveResultPoint;
|
VECTOR2I moveResultPoint;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
moveResultPoint = Placer()->CurrentEnd();
|
moveResultPoint = Placer()->CurrentEnd();
|
||||||
Move( otherEnd, ¤t );
|
Move( otherEnd, ¤t );
|
||||||
} while( Placer()->CurrentEnd() != moveResultPoint );
|
triesLeft--;
|
||||||
|
} while( Placer()->CurrentEnd() != moveResultPoint && triesLeft );
|
||||||
|
|
||||||
// If we've made it, fix the route and we're done
|
// If we've made it, fix the route and we're done
|
||||||
if( moveResultPoint == otherEnd && otherEndLayers.Overlaps( GetCurrentLayer() ) )
|
if( moveResultPoint == otherEnd && otherEndLayers.Overlaps( GetCurrentLayer() ) )
|
||||||
|
|
Loading…
Reference in New Issue