remaining_estimate -= distance;
}
+void TrainRoutePlanner::TrainRoutingState::advance(const Time::TimeDelta &dt)
+{
+ if(delay>=dt)
+ {
+ delay -= dt;
+ return;
+ }
+
+ float secs = dt/Time::sec;
+ if(delay)
+ {
+ secs -= delay/Time::sec;
+ delay = Time::zero;
+ }
+
+ if(state==MOVING)
+ advance(info->speed*secs);
+}
+
void TrainRoutePlanner::TrainRoutingState::advance_track(unsigned next_path)
{
float distance = occupied_tracks->path_length-offset;
{
time += dt;
for(vector<TrainRoutingState>::iterator i=trains.begin(); i!=trains.end(); ++i)
- {
- if(i->delay)
- {
- i->delay -= dt;
- if(i->delay>Time::zero)
- continue;
- i->delay = Time::zero;
- }
- else if(i->state==MOVING)
- i->advance(i->info->speed*(dt/Time::sec));
- }
+ i->advance(dt);
}
void TrainRoutePlanner::RoutingStep::update_estimate()