X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIFlightPlanCreateCruise.cxx;h=87592197b9ee5c476b29a95d9eb4de2026f1eda0;hb=1eb8d0caa4632b5c99d6a1889bfad60288c38772;hp=05f80c89a7ff9c4d125b09124d92d7f2b2306c33;hpb=a7ccae9fca4d4a23c63bf7dfa7995445f7a4a998;p=flightgear.git diff --git a/src/AIModel/AIFlightPlanCreateCruise.cxx b/src/AIModel/AIFlightPlanCreateCruise.cxx index 05f80c89a..87592197b 100644 --- a/src/AIModel/AIFlightPlanCreateCruise.cxx +++ b/src/AIModel/AIFlightPlanCreateCruise.cxx @@ -127,7 +127,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep, init_waypoint->flaps_down= false; init_waypoint->finished = false; init_waypoint->on_ground = false; - waypoints.push_back(init_waypoint); + pushBackWaypoint(init_waypoint); routefile.append("Data/AI/FlightPlans"); snprintf(buffer, 32, "%s-%s.txt", dep->getId().c_str(), @@ -221,7 +221,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep, wpt->flaps_down= false; wpt->finished = false; wpt->on_ground = false; - waypoints.push_back(wpt); + pushBackWaypoint(wpt); } if (!(routefile.exists())) @@ -274,7 +274,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep, wpt->flaps_down= false; wpt->finished = false; wpt->on_ground = false; - waypoints.push_back(wpt); + pushBackWaypoint(wpt); } */ @@ -292,20 +292,22 @@ bool FGAIFlightPlan::createCruise(FGAIAircraft *ac, bool firstFlight, FGAirport double alt, const string& fltType) { double vCruise = ac->getPerformance()->vCruise(); - waypoint *wpt; + FGAIWaypoint *wpt; wpt = createInAir(ac, "Cruise", SGGeod::fromDeg(longitude, latitude), alt, vCruise); - waypoints.push_back(wpt); + pushBackWaypoint(wpt); string rwyClass = getRunwayClassFromTrafficType(fltType); double heading = ac->getTrafficRef()->getCourse(); arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway, heading); - rwy = arr->getRunwayByIdent(activeRunway); + FGRunway* rwy = arr->getRunwayByIdent(activeRunway); + assert( rwy != NULL ); // begin descent 110km out SGGeod beginDescentPoint = rwy->pointOnCenterline(0); SGGeod secondaryDescentPoint = rwy->pointOnCenterline(-10000); wpt = createInAir(ac, "BOD", beginDescentPoint, alt, vCruise); - waypoints.push_back(wpt); + pushBackWaypoint(wpt); wpt = createInAir(ac, "BOD2", secondaryDescentPoint, alt, vCruise); - waypoints.push_back(wpt); + pushBackWaypoint(wpt); + return true; }