router: don't run optimizer if head line == NULL or on shove failure

This commit is contained in:
Tomasz Wlostowski 2015-07-02 16:09:38 +02:00 committed by Maciej Suminski
parent 52e193eded
commit 4abcc159d2
1 changed files with 10 additions and 7 deletions

View File

@ -1028,7 +1028,10 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
return SH_INCOMPLETE; return SH_INCOMPLETE;
st = shoveMainLoop(); st = shoveMainLoop();
runOptimizer( m_currentNode, head );
if( ( st == SH_OK || st == SH_HEAD_MODIFIED ) && head)
runOptimizer( m_currentNode, head );
if( m_newHead && st == SH_OK ) if( m_newHead && st == SH_OK )
{ {
@ -1116,7 +1119,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
//m_logger.Log( head, 0, "head" ); //m_logger.Log( head, 0, "head" );
st = shoveMainLoop(); st = shoveMainLoop();
runOptimizer( m_currentNode, NULL );
if ( st == SH_OK )
runOptimizer( m_currentNode, NULL );
m_currentNode->RemoveByMarker( MK_HEAD ); m_currentNode->RemoveByMarker( MK_HEAD );
@ -1163,8 +1168,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
st = pushVia( aVia, ( aWhere - aVia->Pos() ), 0 ); st = pushVia( aVia, ( aWhere - aVia->Pos() ), 0 );
st = shoveMainLoop(); st = shoveMainLoop();
runOptimizer( m_currentNode, NULL );
//m_currentNode->RemoveByMarker( MK_HEAD ); if ( st == SH_OK )
runOptimizer( m_currentNode, NULL );
if( st == SH_OK || st == SH_HEAD_MODIFIED ) if( st == SH_OK || st == SH_HEAD_MODIFIED )
{ {
@ -1186,9 +1192,6 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead )
{ {
if(!aHead->SegmentCount())
return;
PNS_OPTIMIZER optimizer( aNode ); PNS_OPTIMIZER optimizer( aNode );
int optFlags = 0, n_passes = 0; int optFlags = 0, n_passes = 0;