From 6223ead021d5e02ab0a6d3aed83d5c8b420cacb6 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 21 Feb 2015 20:30:15 +0200 Subject: [PATCH] Only schedule a sequence check if we're waiting at a sequence point --- source/libr2c2/trainrouter.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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; } -- 2.43.0