From: Mikko Rasa Date: Tue, 3 Feb 2015 14:23:01 +0000 (+0200) Subject: Avoid going past the end of route when a new one is set X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2fec8b40d8cd953e36362773e440e50cc4f94a91;p=r2c2.git Avoid going past the end of route when a new one is set Calling stop_at(0) causes the block allocator to immediately resume allocating blocks. In certain circumstances this would cause an allocation past the end of the route. --- diff --git a/source/libr2c2/trainrouter.cpp b/source/libr2c2/trainrouter.cpp index ca3e93d..d1cb6ff 100644 --- a/source/libr2c2/trainrouter.cpp +++ b/source/libr2c2/trainrouter.cpp @@ -111,8 +111,9 @@ void TrainRouter::route_changed() { // We are not at the end of the route now, but might have been before. arrival = ON_THE_WAY; - train.stop_at(0); train.refresh_blocks_from(*fncb); + if(!arrival) + train.stop_at(0); } else if(!arrival) {