X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrainrouter.cpp;h=9a9d338728140a8edcec2420a821535c9dca38d9;hb=74f8c3beba5a6947a523119e3f26cf745725b511;hp=9befe4788c4b03114cfe4939f6ea7c02eee0fe06;hpb=83c6923396fcfa42e6adf949b9476663f322748b;p=r2c2.git diff --git a/source/libr2c2/trainrouter.cpp b/source/libr2c2/trainrouter.cpp index 9befe47..9a9d338 100644 --- a/source/libr2c2/trainrouter.cpp +++ b/source/libr2c2/trainrouter.cpp @@ -1,3 +1,4 @@ +#include "driver.h" #include "layout.h" #include "route.h" #include "trackiter.h" @@ -118,7 +119,7 @@ void TrainRouter::route_changed() if(!sequence_points.empty()) { const SequencePoint &sp = sequence_points.front(); - if(sp.block==fncb.block() && !sp.is_cleared()) + if(sp.block==fncb.block() && sp.preceding_train) { arrival = WAITING_FOR_SEQUENCE; sequence_check_pending = true; @@ -225,24 +226,28 @@ void TrainRouter::message(const Message &msg) void TrainRouter::tick(const Time::TimeDelta &dt) { - if(delay) - { - delay -= dt; - if(delaycheck()!=TrainRoutePlanner::PENDING) apply_plan(train.get_layout(), *planner); + Layout &layout = train.get_layout(); + if(!layout.get_driver().is_halted() && !layout.get_clock().is_stopped()) + { + if(delay) + { + delay -= dt; + if(delay routers; get_routers(layout, routers);