offset = 0;
}
+void TrainRoutePlanner::TrainRoutingState::set_path(unsigned p)
+{
+ path = p;
+ OccupiedTrack *next_occ = occupied_tracks->next;
+ if(!--occupied_tracks->refcount)
+ delete occupied_tracks;
+ occupied_tracks = new OccupiedTrack(*track, path, next_occ);
+ update_estimate();
+}
+
void TrainRoutePlanner::TrainRoutingState::update_estimate()
{
TrackIter iter = track.reverse(path);
{
TrainRoutingState &train = next.trains[train_index];
- train.path = path;
- train.update_estimate();
+ train.set_path(path);
next.update_estimate();
if(next.is_viable())
new_steps.push_back(next);