From 1e0e7f7ffa51fb4cad3038430674a13f611c1b29 Mon Sep 17 00:00:00 2001 From: James Turner <zakalawe@mac.com> Date: Sun, 3 Feb 2019 13:38:22 +0000 Subject: [PATCH] Rename {ai}/controls/flight/longitude-mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assuming this should have been ‘vertical-mode’ all along, since the corresponding other mode property is called ‘lateral-mode’. Make an alias to the old name to keep existing scripts working. --- src/AIModel/AIAircraft.cxx | 2 +- src/AIModel/AIBase.cxx | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index b4325b6c2..9a5d9b80c 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -1041,7 +1041,7 @@ void FGAIAircraft::updatePrimaryTargetValues(double dt, bool& flightplanActive, } string lon_mode - = props->getStringValue("controls/flight/longitude-mode"); + = props->getStringValue("controls/flight/vertical-mode"); if ( lon_mode == "alt" ) { double alt = props->getDoubleValue("controls/flight/target-alt" ); ClimbTo( alt ); diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 9b8954ad6..fad4e36d5 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -239,7 +239,8 @@ void FGAIBase::readFromScenario(SGPropertyNode* scFileNode) setLongitude(scFileNode->getDoubleValue("longitude", 0.0)); setLatitude(scFileNode->getDoubleValue("latitude", 0.0)); setBank(scFileNode->getDoubleValue("roll", 0.0)); - + setPitch(scFileNode->getDoubleValue("pitch", 0.0)); + SGPropertyNode* submodels = scFileNode->getChild("submodels"); if (submodels) { @@ -707,7 +708,13 @@ void FGAIBase::bind() { props->setDoubleValue("controls/flight/target-hdg", hdg); props->setDoubleValue("controls/flight/target-roll", roll); - props->setStringValue("controls/flight/longitude-mode", "alt"); + props->setStringValue("controls/flight/vertical-mode", "alt"); + + // The property above was incorrectly labelled 'longitude-mode' up until + // FG 2018.4, so create an alias in case anyone is relying on the old name + auto node = props->getNode("controls/flight/longitude-mode", true); + node->alias(props->getNode("controls/flight/vertical-mode")); + props->setDoubleValue("controls/flight/target-alt", altitude_ft); props->setDoubleValue("controls/flight/target-pitch", pitch);