remaining_estimate = distance;
}
+bool TrainRoutePlanner::TrainRoutingState::is_viable() const
+{
+ if(remaining_estimate<0)
+ return false;
+ if(critical && state==BLOCKED)
+ return false;
+ return true;
+}
+
TrainRoutePlanner::RoutingStep::RoutingStep():
prev(0)
{
i->blocked_by = get_occupant(*next_track);
if(i->blocked_by>=0)
+ {
+ if(i->info->first_noncritical->has_track(*next_track))
+ i->critical = false;
i->state = BLOCKED;
+ }
else if(i->state==BLOCKED)
i->state = MOVING;
}
bool TrainRoutePlanner::RoutingStep::is_viable() const
{
for(vector<TrainRoutingState>::const_iterator i=trains.begin(); i!=trains.end(); ++i)
- if(i->remaining_estimate<0)
+ if(!i->is_viable())
return false;
for(vector<TrainRoutingState>::const_iterator i=trains.begin(); i!=trains.end(); ++i)