pub fn zone_cost(mvmnt: MovementID, constraints: PathConstraints, map: &Map) -> Duration {
    // Detect when we cross into a new zone that doesn't allow constraints.
    if map
        .get_r(mvmnt.from.id)
        .access_restrictions
        .allow_through_traffic
        .contains(constraints)
        && !map
            .get_r(mvmnt.to.id)
            .access_restrictions
            .allow_through_traffic
            .contains(constraints)
    {
        // This should be high enough to achieve the desired effect of somebody not entering
        // the zone unless absolutely necessary. Someone would violate that and cut through anyway
        // only when the alternative route would take more than 3 hours longer!
        Duration::hours(3)
    } else {
        Duration::ZERO
    }
}
/// Heavily penalize crossing into an access-restricted zone that doesn't allow this mode.
Heavily penalize crossing into an access-restricted zone that doesn't allow this mode.
Heavily penalize crossing into an access - restricted zone that doesn ' t allow this mode .
pub fn zone_cost(mvmnt: MovementID, constraints: PathConstraints, map: &Map) -> Duration {
    // Detect when we cross into a new zone that doesn't allow constraints.
    if map
        .get_r(mvmnt.from.id)
        .access_restrictions
        .allow_through_traffic
        .contains(constraints)
        && !map
            .get_r(mvmnt.to.id)
            .access_restrictions
            .allow_through_traffic
            .contains(constraints)
    {
        // This should be high enough to achieve the desired effect of somebody not entering
        // the zone unless absolutely necessary. Someone would violate that and cut through anyway
        // only when the alternative route would take more than 3 hours longer!
        Duration::hours(3)
    } else {
        Duration::ZERO
    }
}
pub fn zone_cost ( mvmnt : MovementID , constraints : PathConstraints , map : & Map ) -> Duration { // Detect when we cross into a new zone that doesn't allow constraints. if map . get_r ( mvmnt . from . id ) . access_restrictions . allow_through_traffic . contains ( constraints ) && ! map . get_r ( mvmnt . to . id ) . access_restrictions . allow_through_traffic . contains ( constraints ) { // This should be high enough to achieve the desired effect of somebody not entering // the zone unless absolutely necessary. Someone would violate that and cut through anyway // only when the alternative route would take more than 3 hours longer! Duration :: hours ( 3 ) } else { Duration :: ZERO } }
Heavily penalize crossing into an access-restricted zone that doesn't allow this mode.
Heavily penalize crossing into an access - restricted zone that doesn ' t allow this mode .
mvmnt
MovementID
constraints
PathConstraints
map
&Map