function [min_dist,min_f] = UTM_im_prec_flight(flights,lane_number,fc)
% UTM_im_prec_flight - get info on flight immediately preceding fc in lane
% On input:
%     flights (flight struct): flight info
%     lane_number (int): lane index
%     fc (int): current flight index
% On output:
%     min_dist (float): distance along lane
%     min_f (int): flight index
% Call:
%     [md,mf] = UTM_im_prec_flight(flights,3,5);
% Author:
%     T. Henderson
%     UU
%     Summer 2020
%

WAITING = 1;
IN_FLIGHT = 0;
DONE = -1;

min_dist = 0;
min_f = 0;

f_list = UTM_flights_in_lane(flights,lane_number);
index = find(f_list(:,1)==fc);
if index<length(f_list(:,1))
    min_dist = f_list(index+1,2) - f_list(index,2);
    min_f = f_list(index+1,1);
end
