src/route.c
/*
 * Add a route to this set.
 */
Add a route to this set.
Add a route to this set .
int add_route(route_set_t* curr_set, route_t* new_route){
    if ((curr_set->curr_end !=0) &&
        ((curr_set->last_route->terminal != new_route->origin) ||
        (new_route->start_time <= curr_set->curr_end))) {
        return 1;
    }
    if (curr_set->first_route == NULL) {
        curr_set->first_route = new_route;
        curr_set->last_route = new_route;
    } else {
        new_route->prev_route = curr_set->last_route;
        curr_set->last_route->next_route = new_route;
    }
    curr_set->last_route = new_route;
    curr_set->curr_end = new_route->end_time;
    return 0;
}
int add_route ( route_set_t * curr_set , route_t * new_route ) { if ( ( curr_set -> curr_end != 0 ) && ( ( curr_set -> last_route -> terminal != new_route -> origin ) || ( new_route -> start_time <= curr_set -> curr_end ) ) ) { return 1 ; } if ( curr_set -> first_route == NULL ) { curr_set -> first_route = new_route ; curr_set -> last_route = new_route ; } else { new_route -> prev_route = curr_set -> last_route ; curr_set -> last_route -> next_route = new_route ; } curr_set -> last_route = new_route ; curr_set -> curr_end = new_route -> end_time ; return 0 ; }
Add a route to this set.
Add a route to this set .
// Can we add it? // This criteria checks against: //  a) There are any routes in here //  b) The start time is within the MIN ROUTE GAP //if ((curr_set->curr_end !=0) && (new_route->start_time < (curr_set->curr_end + MIN_ROUTE_GAP))) { //    return 1; //} // This criteria requres: // 	a) That new route picks up at the same station // 	b) starts strictly after its arrival // Actually staple it to the end // Bump the endings