]> git.tdb.fi Git - r2c2.git/commitdiff
Don't set pure_speed and accurate_position when halted
authorMikko Rasa <tdb@tdb.fi>
Sun, 6 Apr 2014 20:28:53 +0000 (23:28 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 6 Apr 2014 20:28:53 +0000 (23:28 +0300)
It may happen that the train has enough momentum to roll onto the next
sensor when halt occurs.  Setting accurate_position in this case is
likely to cause a sensor missed emergency when halt is lifted, as the
physical locomotive takes a moment to get up to speed again.

source/libr2c2/train.cpp

index 34b80ddcc39d213635431e50613ecdce29776d51..8e10026f182bee49987318eb0daee177ad679873 100644 (file)
@@ -487,8 +487,11 @@ void Train::sensor_state_changed(Sensor &sensor, Sensor::State state)
 
                last_entry_block = allocator.iter_for(*block);
                travel_time = Time::zero;
-               pure_speed = true;
-               accurate_position = true;
+               if(!layout.get_driver().is_halted())
+               {
+                       pure_speed = true;
+                       accurate_position = true;
+               }
                overshoot_dist = 0;
 
                if(!advancing && vehicles.front()->is_placed())