router: allow caller to override the 'safety' length limit in WALKAROUND

This commit is contained in:
Tomasz Wlostowski 2022-10-27 00:27:01 +02:00
parent 363d606503
commit 70bca1b2d5
2 changed files with 8 additions and 1 deletions

View File

@ -173,7 +173,7 @@ const WALKAROUND::RESULT WALKAROUND::Route( const LINE& aInitialPath )
break; break;
// Safety valve // Safety valve
if( path_cw.Line().Length() > lengthLimit && path_ccw.Line().Length() > lengthLimit ) if( m_lengthLimitOn && path_cw.Line().Length() > lengthLimit && path_ccw.Line().Length() > lengthLimit )
break; break;
m_iteration++; m_iteration++;

View File

@ -49,6 +49,7 @@ public:
m_iteration = 0; m_iteration = 0;
m_forceCw = false; m_forceCw = false;
m_forceLongerPath = false; m_forceLongerPath = false;
m_lengthLimitOn = true;
} }
~WALKAROUND() {}; ~WALKAROUND() {};
@ -111,6 +112,11 @@ public:
const RESULT Route( const LINE& aInitialPath ); const RESULT Route( const LINE& aInitialPath );
void SetLengthLimit( bool aEnable )
{
m_lengthLimitOn = aEnable;
}
private: private:
void start( const LINE& aInitialPath ); void start( const LINE& aInitialPath );
@ -129,6 +135,7 @@ private:
std::set<ITEM*> m_restrictedSet; std::set<ITEM*> m_restrictedSet;
std::vector<VECTOR2I> m_restrictedVertices; std::vector<VECTOR2I> m_restrictedVertices;
bool m_forceLongerPath; bool m_forceLongerPath;
bool m_lengthLimitOn;
}; };
} }