]> git.tdb.fi Git - r2c2.git/commitdiff
Only schedule a sequence check if we're waiting at a sequence point
authorMikko Rasa <tdb@tdb.fi>
Sat, 21 Feb 2015 18:30:15 +0000 (20:30 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 21 Feb 2015 18:30:15 +0000 (20:30 +0200)
source/libr2c2/trainrouter.cpp

index f0870d250f2b7b95293797a2c86a8c72addf56c1..a40e8ffb23d3c369fc70e2e6712115ce44f4bf67 100644 (file)
@@ -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;
        }