-void Track::check_slope()
-{
- if(endpoints.size()!=2)
- return;
-
- Track *link1=endpoints.front().link;
- Track *link2=endpoints.back().link;
- if(link1 && link2)
- {
- const Endpoint *ep1=link1->get_endpoint_by_link(this);
- const Endpoint *ep2=link2->get_endpoint_by_link(this);
- pos.z=link1->pos.z+ep1->pos.z;
- slope=(link2->pos.z+ep2->pos.z)-pos.z;
- }
- else
- {
- slope=0;
- if(link1)
- {
- const Endpoint *ep=link1->get_endpoint_by_link(this);
- pos.z=link1->pos.z+ep->pos.z;
- }
- else if(link2)
- {
- const Endpoint *ep=link2->get_endpoint_by_link(this);
- pos.z=link2->pos.z+ep->pos.z;
- }
- }
-
- endpoints.back().pos.z=slope;
-}
-
-const Track::Endpoint *Track::traverse(const Endpoint *ep, unsigned route) const
-{
- if(ep->routes&(1<<route))
- {
- // Find the other endpoint for this route
- for(EndpointSeq::const_iterator i=endpoints.begin(); i!=endpoints.end(); ++i)
- if((i->routes&(1<<route)) && &*i!=ep)
- return &*i;
- }
- else
- {
- // Find an endpoint that's connected to this one and has the requested route
- for(EndpointSeq::const_iterator i=endpoints.begin(); i!=endpoints.end(); ++i)
- if((i->routes&(1<<route)) && (i->routes&ep->routes))
- return &*i;
- }
-
- return 0;
-}
-
-Track *Track::copy() const