From ab3073367fb8e7d7b534b5c5b81a16346ba20717 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 20 Nov 2013 21:25:11 +0200 Subject: [PATCH] Avoid advancing to a pending block This fixes a problem where a train would wait for a turnout to be freed, then reserve it and immediately advance to it, triggering a false arrival in the router. --- source/libr2c2/blockallocator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libr2c2/blockallocator.cpp b/source/libr2c2/blockallocator.cpp index 2c92ddc..6e2a11c 100644 --- a/source/libr2c2/blockallocator.cpp +++ b/source/libr2c2/blockallocator.cpp @@ -339,6 +339,9 @@ void BlockAllocator::advance_front(const Block *block, bool inclusive) else end = blocks.end(); + if(end==blocks.end() && blocks.back().block()==pending_block) + --end; + SetFlag setf(advancing); BlockList::iterator i = cur_blocks_end; // Update cur_blocks_end first to keep things consistent. -- 2.45.2