From: Mikko Rasa Date: Wed, 20 Nov 2013 19:25:11 +0000 (+0200) Subject: Avoid advancing to a pending block X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ab3073367fb8e7d7b534b5c5b81a16346ba20717;p=r2c2.git 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. --- 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.