TrackIter track = train.get_block_allocator().first().track_iter();
for(; track; track=track.next())
{
- if(!advance_to_track(reserving_route, *track))
+ if(!advance_to_track(reserving_route, track))
{
already_at_end = true;
break;
track = t->get_block_allocator().first().track_iter();
for(; track; track=track.next())
{
- if(!advance_to_track(reserving_route, *track))
+ if(!advance_to_track(reserving_route, track))
throw logic_error("internal error (reservation outside of route)");
else if(&track->get_block()==&block)
break;
expected to be allocated next. */
for(; track; track=track.next((*reserving_route)->get_path(*track)))
{
- if(!advance_to_track(reserving_route, *track))
+ if(!advance_to_track(reserving_route, track))
{
// We've reached the end of the route. Stop here.
arrival = RESERVED_TO_END;
return true;
}
-bool TrainRouter::is_valid_for_track(const Route &route, Track &track) const
+bool TrainRouter::is_valid_for_track(const Route &route, const TrackIter &track) const
{
- if(!route.has_track(track))
+ if(!route.has_track(*track))
return false;
- if(track.get_type().is_turnout() && route.get_turnout(track.get_turnout_address())<0)
+ if(track->get_type().is_turnout() && route.get_turnout(track->get_turnout_address())<0 && route.has_track(*track.flip()))
return false;
return true;
}
-bool TrainRouter::advance_to_track(RouteList::iterator &route, Track &track)
+bool TrainRouter::advance_to_track(RouteList::iterator &route, const TrackIter &track)
{
if(!is_valid_for_track(**route, track))
{
void create_metrics();
bool create_lead_route();
- bool is_valid_for_track(const Route &, Track &) const;
- bool advance_to_track(RouteList::iterator &, Track &);
+ bool is_valid_for_track(const Route &, const TrackIter &) const;
+ bool advance_to_track(RouteList::iterator &, const TrackIter &);
static void start_planning(Layout &);
};