Ensure that cruise parameters are set when cloning flightplan
This commit is contained in:
parent
cdacea1315
commit
3255105190
2 changed files with 19 additions and 1 deletions
|
@ -140,6 +140,19 @@ FlightPlan* FlightPlan::clone(const string& newIdent) const
|
|||
c->_arrivalChanged = false;
|
||||
c->_departureChanged = false;
|
||||
|
||||
// copy cruise data
|
||||
if (_cruiseFlightLevel > 0) {
|
||||
c->setCruiseFlightLevel(_cruiseFlightLevel);
|
||||
} else if (_cruiseAltitudeFt > 0) {
|
||||
c->setCruiseAltitudeFt(_cruiseAltitudeFt);
|
||||
}
|
||||
|
||||
if (_cruiseAirspeedMach > 0) {
|
||||
c->setCruiseSpeedMach(_cruiseAirspeedMach);
|
||||
} else if (_cruiseAirspeedKnots > 0) {
|
||||
c->setCruiseSpeedKnots(_cruiseAirspeedKnots);
|
||||
}
|
||||
|
||||
c->_didLoadFP = true; // set the loaded flag to give delegates a chance
|
||||
|
||||
// copy legs
|
||||
|
|
|
@ -926,7 +926,10 @@ void FlightplanTests::testCloningBasic()
|
|||
FlightPlanRef fp1 = makeTestFP("EGCC", "23L", "EHAM", "24",
|
||||
"TNT CLN");
|
||||
fp1->setIdent("testplan");
|
||||
|
||||
|
||||
fp1->setCruiseAltitudeFt(24000);
|
||||
fp1->setCruiseSpeedKnots(448);
|
||||
|
||||
auto fp2 = fp1->clone("testplan2");
|
||||
|
||||
CPPUNIT_ASSERT(fp2->ident() == "testplan2");
|
||||
|
@ -934,6 +937,8 @@ void FlightplanTests::testCloningBasic()
|
|||
CPPUNIT_ASSERT(fp2->departureRunway()->ident() == "23L");
|
||||
CPPUNIT_ASSERT(fp2->destinationAirport()->ident() == "EHAM");
|
||||
CPPUNIT_ASSERT(fp2->destinationRunway()->ident() == "24");
|
||||
CPPUNIT_ASSERT_EQUAL(24000, fp2->cruiseAltitudeFt());
|
||||
CPPUNIT_ASSERT_EQUAL(448, fp2->cruiseSpeedKnots());
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(5, fp2->numLegs());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue