router: log and replay the 'unfix' events too

This commit is contained in:
Tomasz Wlostowski 2022-11-15 23:02:01 +01:00
parent b507c44d74
commit 26a38797c7
3 changed files with 14 additions and 1 deletions

View File

@ -49,7 +49,8 @@ public:
EVT_FIX, EVT_FIX,
EVT_MOVE, EVT_MOVE,
EVT_ABORT, EVT_ABORT,
EVT_TOGGLE_VIA EVT_TOGGLE_VIA,
EVT_UNFIX
}; };
struct EVENT_ENTRY { struct EVENT_ENTRY {

View File

@ -884,6 +884,7 @@ void ROUTER::UndoLastSegment()
if( !RoutingInProgress() ) if( !RoutingInProgress() )
return; return;
m_logger->Log( LOGGER::EVT_UNFIX );
m_placer->UnfixRoute(); m_placer->UnfixRoute();
} }

View File

@ -145,6 +145,16 @@ void PNS_LOG_PLAYER::ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex, int aF
break; break;
} }
case LOGGER::EVT_UNFIX:
{
m_debugDecorator->NewStage( "unfix", 0, PNSLOGINFO );
m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 );
m_debugDecorator->Message( wxString::Format( "unfix (%d, %d)", evt.p.x, evt.p.y ) );
printf( " unfix\n" );
m_router->UndoLastSegment();
break;
}
case LOGGER::EVT_MOVE: case LOGGER::EVT_MOVE:
{ {
m_debugDecorator->NewStage( "move", 0, PNSLOGINFO ); m_debugDecorator->NewStage( "move", 0, PNSLOGINFO );
@ -232,6 +242,7 @@ bool PNS_LOG_PLAYER::CompareResults( PNS_LOG_FILE* aLog )
{ {
auto cstate = GetRouterUpdatedItems(); auto cstate = GetRouterUpdatedItems();
printf("Comparing %lu added/%lu removed items\n", cstate.m_addedItems.size(), cstate.m_removedIds.size() );
return cstate.Compare( aLog->GetExpectedResult() ); return cstate.Compare( aLog->GetExpectedResult() );
} }