X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftrain.cpp;h=d9bade7dca338c5f20a53ca2624f53f2d4420298;hb=8e3009751ee81e0e5312cae53ee844bdd9e49628;hp=e4afef7e37c516b17e74960e73e88d39f7bb8fd7;hpb=f054840cec26b55d68910e750192079f0c6e0230;p=r2c2.git diff --git a/source/libmarklin/train.cpp b/source/libmarklin/train.cpp index e4afef7..d9bade7 100644 --- a/source/libmarklin/train.cpp +++ b/source/libmarklin/train.cpp @@ -291,7 +291,7 @@ bool Train::divert(Track &from) int route_path = route->route->get_turnout(from.get_turnout_id()); // Check that more than one path is available - unsigned ep_paths = track->get_type().get_endpoints()[track.entry()].paths; + unsigned ep_paths = track.endpoint().paths; if(!(ep_paths&(ep_paths-1))) return false; @@ -391,7 +391,7 @@ void Train::place(Block &block, unsigned entry) } else { - const Block::Endpoint &bep = block.get_endpoints()[entry]; + const Block::Endpoint &bep = block.get_endpoint(entry); vehicles.back()->place(*bep.track, bep.track_ep, 0, Vehicle::BACK_BUFFER); } } @@ -730,9 +730,9 @@ void Train::sensor_event(unsigned addr, bool state) // Check if we've reached the next route if(routes.size()>1) { - const set &rtracks = (++routes.begin())->route->get_tracks(); + const Route &route = *(++routes.begin())->route; for(BlockList::iterator j=cur_blocks_end; j!=end; ++j) - if(rtracks.count((*j)->get_endpoints()[j->entry()].track)) + if(route.has_track(*j->track_iter())) { routes.pop_front(); // XXX Exceptions? @@ -952,7 +952,7 @@ void Train::reserve_more() if(block->get_turnout_id()) { - const TrackType::Endpoint &track_ep = track->get_type().get_endpoints()[track.entry()]; + const TrackType::Endpoint &track_ep = track.endpoint(); bool multiple_paths = (track_ep.paths&(track_ep.paths-1)); if(multiple_paths && cur_route!=routes.end() && cur_route->diversion!=block->get_turnout_id()) @@ -1006,14 +1006,14 @@ void Train::check_turnout_paths(bool set) if((*i)->get_turnout_id()) { TrackIter track = i->track_iter(); - const TrackType::Endpoint &track_ep = track->get_type().get_endpoints()[track.entry()]; + const TrackType::Endpoint &track_ep = track.endpoint(); unsigned path = 0; list::iterator j = i; if(++j!=blocks.end()) { TrackIter rev = j->track_iter().flip(); - unsigned mask = rev->get_type().get_endpoints()[rev.entry()].paths&track_ep.paths; + unsigned mask = rev.endpoint().paths&track_ep.paths; for(path=0; mask>1; mask>>=1, ++path) ; } else