From: Mikko Rasa Date: Sat, 21 May 2011 07:40:54 +0000 (+0000) Subject: Avoid deactivating while the controller still has nonzero speed X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a72309e64614bb1e230f9842d94dc261be1301e6;p=r2c2.git Avoid deactivating while the controller still has nonzero speed --- diff --git a/source/libr2c2/train.cpp b/source/libr2c2/train.cpp index 00730c8..93ebebe 100644 --- a/source/libr2c2/train.cpp +++ b/source/libr2c2/train.cpp @@ -583,6 +583,7 @@ void Train::tick(const Time::TimeStamp &t, const Time::TimeDelta &dt) (*i)->tick(t, dt); controller->tick(dt); float speed = controller->get_speed(); + bool moving = speed>0; if(controller->get_reverse()!=reverse) { @@ -609,7 +610,7 @@ void Train::tick(const Time::TimeStamp &t, const Time::TimeDelta &dt) speed = speed_quantizer->get_speed(current_speed_step); } - if(speed) + if(moving) { if(!active) set_active(true);