This shortens the incantation to get the length of the active path.
break;
blocks_to_reserve.push_back(b);
for(TrackIter t=b.track_iter(); (t && &t->get_block()==&*b); t=t.next())
- remaining_length -= t->get_type().get_path_length(t->get_active_path());
+ remaining_length -= t->get_path_length();
if(remaining_length<=0)
break;
}
layout.get_driver().set_turnout(turnout_id, p);
}
+float Track::get_path_length(int p) const
+{
+ if(p<0)
+ p = active_path;
+ return type.get_path_length(p);
+}
+
OrientedPoint Track::get_point(unsigned epi, unsigned path, float d) const
{
OrientedPoint p = type.get_point(epi, path, d);
void set_active_path(unsigned);
unsigned get_active_path() const { return active_path; }
bool is_path_changing() const { return path_changing; }
+ float get_path_length(int = -1) const;
OrientedPoint get_point(unsigned, unsigned, float) const;
OrientedPoint get_point(unsigned, float) const;
if(reverse)
track = track.reverse();
else
- result = track->get_type().get_path_length(track->get_active_path())-result;
+ result = track->get_path_length()-result;
result -= veh.get_type().get_length()/2;
BlockIter block = track.block_iter();
// Count remaining distance in the vehicle's current block
for(track=track.next(); &track->get_block()==&*block; track=track.next())
- result += track->get_type().get_path_length(track->get_active_path());
+ result += track->get_path_length();
const BlockIter &last = allocator.last();
if(&*block==&*last)