X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FTraffic%2FSchedFlight.cxx;h=56db6204cba1cba31b04cd9b3c1462584190046a;hb=157eb857ef36636a316947fe1eb3d9a8bea1959b;hp=a66915a1e0831069d2772ada688ab00c2560bef9;hpb=666910a7937712d02e62a38a83ced564f6227f52;p=flightgear.git diff --git a/src/Traffic/SchedFlight.cxx b/src/Traffic/SchedFlight.cxx index a66915a1e..56db6204c 100644 --- a/src/Traffic/SchedFlight.cxx +++ b/src/Traffic/SchedFlight.cxx @@ -79,21 +79,25 @@ FGScheduledFlight::FGScheduledFlight() { + initialized = false; + available = true; } FGScheduledFlight::FGScheduledFlight(const FGScheduledFlight &other) { - callsign = other.callsign; - fltRules = other.fltRules; - departurePort = other.departurePort; - depId = other.depId; - arrId = other.arrId; - departureTime = other.departureTime; - cruiseAltitude = other.cruiseAltitude; - arrivalPort = other.arrivalPort; - arrivalTime = other.arrivalTime; - repeatPeriod = other.repeatPeriod; - initialized = other.initialized; + callsign = other.callsign; + fltRules = other.fltRules; + departurePort = other.departurePort; + depId = other.depId; + arrId = other.arrId; + departureTime = other.departureTime; + cruiseAltitude = other.cruiseAltitude; + arrivalPort = other.arrivalPort; + arrivalTime = other.arrivalTime; + repeatPeriod = other.repeatPeriod; + initialized = other.initialized; + requiredAircraft = other.requiredAircraft; + available = other.available; } FGScheduledFlight::FGScheduledFlight(const string& cs, @@ -103,7 +107,8 @@ FGScheduledFlight::FGScheduledFlight(const string& cs, int cruiseAlt, const string& deptime, const string& arrtime, - const string& rep) + const string& rep, + const string& reqAC) { callsign = cs; fltRules = fr; @@ -115,6 +120,7 @@ FGScheduledFlight::FGScheduledFlight(const string& cs, //departureTime = processTimeString(deptime); //arrivalTime = processTimeString(arrtime); cruiseAltitude = cruiseAlt; + requiredAircraft = reqAC; // Process the repeat period string if (rep.find("WEEK",0) != string::npos) @@ -127,19 +133,22 @@ FGScheduledFlight::FGScheduledFlight(const string& cs, } else { - cerr << "Unknown repeat period" << endl; - exit(1); + repeatPeriod = 365*24*60*60; + SG_LOG( SG_GENERAL, SG_ALERT, "Unknown repeat period in flight plan " + "of flight '" << cs << "': " << rep ); } // What we still need to do is preprocess the departure and // arrival times. departureTime = processTimeString(deptime); arrivalTime = processTimeString(arrtime); + //departureTime += rand() % 300; // Make sure departure times are not limited to 5 minute increments. if (departureTime > arrivalTime) { departureTime -= repeatPeriod; } initialized = false; + available = true; } @@ -262,13 +271,13 @@ FGAirport * FGScheduledFlight::getArrivalAirport () bool FGScheduledFlight::initializeAirports() { //cerr << "Initializing using : " << depId << " " << arrId << endl; - departurePort = globals->get_airports()->search(depId); + departurePort = FGAirport::findByIdent(depId); if(departurePort == NULL) { SG_LOG( SG_GENERAL, SG_WARN, "Traffic manager could not find departure airport : " << depId); return false; } - arrivalPort = globals->get_airports()->search(arrId); + arrivalPort = FGAirport::findByIdent(arrId); if(arrivalPort == NULL) { SG_LOG( SG_GENERAL, SG_WARN, "Traffic manager could not find arrival airport : " << arrId);