]> git.tdb.fi Git - r2c2.git/commitdiff
Avoid advancing to a pending block
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Nov 2013 19:25:11 +0000 (21:25 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Nov 2013 19:25:11 +0000 (21:25 +0200)
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

index 2c92ddc647a5178672200f3cb49ffc5b62f18715..6e2a11cde0bedf77295b089f97961d8467859c98 100644 (file)
@@ -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.