]> git.tdb.fi Git - r2c2.git/commitdiff
Mark turnout blocks before the next sensor as current
authorMikko Rasa <tdb@tdb.fi>
Sun, 27 Jan 2013 13:26:18 +0000 (15:26 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 27 Jan 2013 13:26:18 +0000 (15:26 +0200)
This avoids a problem where a train leaving a station wouldn't get the
following turnouts as current if they needed switching, and consequently
could trigger an emergency for not reaching a sensor in time.

source/libr2c2/train.cpp

index ab52ce6ad081bd31eb2b6cd919cc7b9c4e744994..936f74aa82d6d522bb74a7d500a59eeecea0f2d2 100644 (file)
@@ -1105,6 +1105,8 @@ void Train::check_turnout_paths(bool set)
 
                if(i==clear_blocks_end)
                        ++clear_blocks_end;
+               if(i==cur_blocks_end && !(*i)->get_sensor_id())
+                       ++cur_blocks_end;
        }
 }