]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/input.cxx
Added a <solve-weight> subtag of the approach/cruise parameters that can
[flightgear.git] / src / Input / input.cxx
index 887d18d49eb7c18fef0f88a9b78e2bf76693e2fc..9c52389d9b1dfc5674454e41f72d35191f068b49 100644 (file)
@@ -48,8 +48,8 @@
 #include <simgear/props/props.hxx>
 
 #include <Aircraft/aircraft.hxx>
-#include <Autopilot/auto_gui.hxx>
-#include <Autopilot/newauto.hxx>
+// #include <Autopilot/auto_gui.hxx>
+#include <Autopilot/xmlauto.hxx>
 #include <Cockpit/hud.hxx>
 #include <Cockpit/panel.hxx>
 #include <Cockpit/panel_io.hxx>
@@ -94,11 +94,6 @@ FGBinding::FGBinding (const SGPropertyNode * node)
   read(node);
 }
 
-FGBinding::~FGBinding ()
-{
-  delete _arg;                       // Delete the saved arguments
-}
-
 void
 FGBinding::read (const SGPropertyNode * node)
 {
@@ -113,7 +108,6 @@ FGBinding::read (const SGPropertyNode * node)
     return;
   }
 
-  delete _arg;
   _arg = new SGPropertyNode;
   _setting = 0;
   copyProperties(node, _arg);  // FIXME: don't use whole node!!!
@@ -229,6 +223,9 @@ FGInput::makeDefault (bool status)
 void
 FGInput::doKey (int k, int modifiers, int x, int y)
 {
+    static SGPropertyNode *heading_enabled
+        = fgGetNode("/autopilot/locks/heading", true);
+
                                 // Sanity check.
   if (k < 0 || k >= MAX_KEYS) {
     SG_LOG(SG_INPUT, SG_WARN, "Key value " << k << " out of range");
@@ -303,14 +300,11 @@ FGInput::doKey (int k, int modifiers, int x, int y)
 // START SPECIALS
 
         case 256+GLUT_KEY_F6: // F6 toggles Autopilot target location
-            if ( globals->get_autopilot()->get_HeadingMode() !=
-                 FGAutopilot::FG_HEADING_WAYPOINT ) {
-                globals->get_autopilot()->set_HeadingMode(
-                    FGAutopilot::FG_HEADING_WAYPOINT );
-                globals->get_autopilot()->set_HeadingEnabled( true );
+            if ( strcmp( heading_enabled->getStringValue(),
+                         "true-heading-hold" ) != 0 ) {
+                heading_enabled->setStringValue( "true-heading-hold" );
             } else {
-                globals->get_autopilot()->set_HeadingMode(
-                    FGAutopilot::FG_TC_HEADING_LOCK );
+                heading_enabled->setStringValue( "" );
             }
             return;
         }
@@ -454,7 +448,7 @@ FGInput::_init_joystick ()
     jsJoystick * js = new jsJoystick(i);
     _joystick_bindings[i].js = js;
     if (js->notWorking()) {
-      SG_LOG(SG_INPUT, SG_WARN, "Joystick " << i << " not found");
+      SG_LOG(SG_INPUT, SG_DEBUG, "Joystick " << i << " not found");
       continue;
     } else {
       bool found_js = false;
@@ -622,8 +616,11 @@ FGInput::_init_mouse ()
                                 // Grab node pointers
     char buf[64];
     sprintf(buf, "/devices/status/mice/mouse[%d]/mode", i);
-    m.mode_node = fgGetNode(buf, true);
-    m.mode_node->setIntValue(0);
+    m.mode_node = fgGetNode(buf);
+    if (m.mode_node == NULL) {
+      m.mode_node = fgGetNode(buf, true);
+      m.mode_node->setIntValue(0);
+    }
     for (j = 0; j < MAX_MOUSE_BUTTONS; j++) {
       sprintf(buf, "/devices/status/mice/mouse[%d]/button[%d]", i, j);
       m.mouse_button_nodes[j] = fgGetNode(buf, true);