return tracks.count(&t);
}
+const Block::Endpoint &Block::get_endpoint(unsigned i) const
+{
+ if(i>=endpoints.size())
+ throw InvalidParameterValue("Endpoint index out of range");
+
+ return endpoints[i];
+}
+
int Block::get_endpoint_by_link(Block &other) const
{
for(unsigned i=0; i<endpoints.size(); ++i)
float result = 0;
while(t_iter && has_track(*t_iter))
{
- int path = -1;
- if(t_iter->get_turnout_id() && route)
- path = route->get_turnout(t_iter->get_turnout_id());
- if(path==-1)
- path = t_iter->get_active_path();
-
+ unsigned path = (route ? route->get_path(*t_iter) : t_iter->get_active_path());
result += t_iter->get_type().get_path_length(path);
t_iter = t_iter.next(path);
void Block::find_paths(TrackIter track, unsigned path)
{
- unsigned mask = track->get_type().get_endpoints()[track.entry()].paths;
+ unsigned mask = track.endpoint().paths;
for(unsigned i=0; mask>>i; ++i)
if(mask&(1<<i))
{