From a72309e64614bb1e230f9842d94dc261be1301e6 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 21 May 2011 07:40:54 +0000 Subject: [PATCH] Avoid deactivating while the controller still has nonzero speed --- source/libr2c2/train.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.45.2