From: Mikko Rasa Date: Sat, 21 Feb 2015 18:30:15 +0000 (+0200) Subject: Only schedule a sequence check if we're waiting at a sequence point X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6223ead021d5e02ab0a6d3aed83d5c8b420cacb6;p=r2c2.git Only schedule a sequence check if we're waiting at a sequence point --- diff --git a/source/libr2c2/trainrouter.cpp b/source/libr2c2/trainrouter.cpp index f0870d2..a40e8ff 100644 --- a/source/libr2c2/trainrouter.cpp +++ b/source/libr2c2/trainrouter.cpp @@ -294,11 +294,14 @@ void TrainRouter::block_reserved(Block &block, Train *t) return; // Are we waiting for the other train to pass a sequence point? - SequencePoint &sp = sequence_points.front(); - if(sp.preceding_train==t && sp.block==&block) - /* The other train's router will advance its sequence on the same - signal and may not have handled it yet. */ - state = SEQUENCE_CHECK_PENDING; + if(state==WAITING_FOR_SEQUENCE) + { + SequencePoint &sp = sequence_points.front(); + if(sp.preceding_train==t && sp.block==&block) + /* The other train's router will advance its sequence on the same + signal and may not have handled it yet. */ + state = SEQUENCE_CHECK_PENDING; + } return; }