]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.cxx
Add --fg-aircraft option, and aircraft dir path list. Partial support in places that...
[flightgear.git] / src / Instrumentation / gps.cxx
index 740c70a38ad40e3f388613531f34bbb16bc3df41..afee154f3f5815dcd0a752e448e2442284ccaab8 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <memory>
 #include <set>
+#include <cstring>
 
 #include "Main/fg_props.hxx"
 #include "Main/globals.hxx" // for get_subsystem
@@ -213,11 +214,13 @@ void GPS::Config::bind(GPS* aOwner, SGPropertyNode* aCfg)
 
 GPS::GPS ( SGPropertyNode *node) : 
   _selectedCourse(0.0),
+  _desiredCourse(0.0),
   _dataValid(false),
   _lastPosValid(false),
   _mode("init"),
   _name(node->getStringValue("name", "gps")),
   _num(node->getIntValue("number", 0)),
+  _searchResultsCached(false),
   _computeTurnData(false),
   _anticipateTurn(false),
   _inTurn(false)
@@ -303,6 +306,7 @@ GPS::init ()
   fromFlag->alias(wp1_node->getChild("from-flag"));
     
 // autopilot drive properties
+  _apDrivingFlag = fgGetNode("/autopilot/settings/gps-driving-true-heading", true);
   _apTrueHeading = fgGetNode("/autopilot/settings/true-heading-deg",true);
   _apTargetAltitudeFt = fgGetNode("/autopilot/settings/target-altitude-ft", true);
   _apAltitudeLock = fgGetNode("/autopilot/locks/altitude", true);
@@ -958,12 +962,17 @@ void GPS::updateRouteData()
 void GPS::driveAutopilot()
 {
   if (!_config.driveAutopilot() || !_realismSimpleGps->getBoolValue()) {
+    _apDrivingFlag->setBoolValue(false);
     return;
   }
  
   // compatability feature - allow the route-manager / GPS to drive the
   // generic autopilot heading hold *in leg mode only* 
-  if (_mode == "leg") {
+  
+  bool drive = _mode == "leg";
+  _apDrivingFlag->setBoolValue(drive);
+  
+  if (drive) {
     // FIXME: we want to set desired track, not heading, here
     _apTrueHeading->setDoubleValue(getWP1Bearing());
   }