From 193220dca4f520379b23160787ec60315903d49c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 6 Feb 2015 16:23:05 +0200 Subject: [PATCH] Immediately process sequence points that are already covered The planner starts from the front buffer of the train, so it may generate sequence points in the existing critical blocks. --- source/libr2c2/trainrouter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/libr2c2/trainrouter.cpp b/source/libr2c2/trainrouter.cpp index cef98ee..38027db 100644 --- a/source/libr2c2/trainrouter.cpp +++ b/source/libr2c2/trainrouter.cpp @@ -77,6 +77,7 @@ void TrainRouter::route_changed() can't rely on the resync code in block_reserved since we may need to clear the stop marker to continue allocation. */ TrackIter track = train.get_block_allocator().first().track_iter(); + list::iterator seq_begin = sequence_points.begin(); for(; track; track=track.next()) { if(!advance_to_track(reserving_route, track)) @@ -86,7 +87,15 @@ void TrainRouter::route_changed() } if(&track->get_block()==fncb.block()) break; + + if(seq_begin!=sequence_points.end() && seq_begin->block==&track->get_block()) + { + current_sequence = seq_begin->sequence_out; + ++seq_begin; + } } + + sequence_points.erase(sequence_points.begin(), seq_begin); } if(!already_at_end) -- 2.45.2