]> git.mxchange.org Git - flightgear.git/commitdiff
Make use of auto-coordination more flexible
authorTorsten Dreyer <Torsten@t3r.de>
Tue, 13 Mar 2012 20:00:22 +0000 (21:00 +0100)
committerTorsten Dreyer <Torsten@t3r.de>
Tue, 13 Mar 2012 20:00:22 +0000 (21:00 +0100)
- move property /sim/auto-coordination to
  /controls/flight/auto-coordination
- introduce new property /controls/flight/auto-coordination-factor
  with default of 0.5
- auto-coordinate the rudder if auto-coordination is true and the factor
  is greater than zero

backward compatibility for the old property is temporary provided by
a temporary Nasal hack in FGDATA/Nasal/aircraft.nas

src/Aircraft/controls.cxx
src/Aircraft/controls.hxx
src/Main/options.cxx

index dcd4a553bee1f96a58b540c8ee9c7470f2f42d13..772ab8e74942bfe75d27969e968560da920fe4a5 100644 (file)
@@ -215,7 +215,12 @@ FGControls::init ()
         alternate_extension[wheel] = false;
     }
 
-    auto_coordination = fgGetNode("/sim/auto-coordination", true);
+    auto_coordination = fgGetNode("/controls/flight/auto-coordination", true);
+    auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", false );
+    if( NULL == auto_coordination_factor ) {
+      auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", true );
+      auto_coordination_factor->setDoubleValue( 0.5 );
+    }
 }
 
 static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
@@ -656,11 +661,7 @@ FGControls::set_aileron (double pos)
 {
     aileron = pos;
     SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
-
-    // check for autocoordination
-    if ( auto_coordination->getBoolValue() ) {
-        set_rudder( aileron / 2.0 );
-    }
+    do_autocoordination();
 }
 
 void
@@ -668,11 +669,7 @@ FGControls::move_aileron (double amt)
 {
     aileron += amt;
     SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
-
-    // check for autocoordination
-    if ( auto_coordination->getBoolValue() ) {
-        set_rudder( aileron / 2.0 );
-    }
+    do_autocoordination();
 }
 
 void
index a738bc27fde89361f96e3fa81bc141c729d4fa88..cc8ce5a71c1339d439b0ba5f37646c0be1cf9f5f 100644 (file)
@@ -253,6 +253,7 @@ private:
      
 
     SGPropertyNode_ptr auto_coordination;
+    SGPropertyNode_ptr auto_coordination_factor;
     simgear::TiedPropertyList _tiedProperties;
 public:
 
@@ -637,6 +638,14 @@ public:
     // controls/autoflight/autopilot[n]/
     void set_autopilot_engage( int ap, bool val );
 
+private:
+    inline void do_autocoordination() {
+      // check for autocoordination
+      if ( auto_coordination->getBoolValue() ) {
+        double factor = auto_coordination_factor->getDoubleValue();
+        if( factor > 0.0 ) set_rudder( aileron * factor );
+      }
+    }    
 };
 
 
index 2d18b736a9e865d40e11c1322b3f6b8869cfdae4..8d40329fbb1357bc8c2d0f4027f6654310b80051 100644 (file)
@@ -176,7 +176,7 @@ fgSetDefaults ()
     // specified so we can do the right thing for voodoo-1/2 cards.
     // fgSetString("/sim/startup/mouse-pointer", "disabled");
     fgSetString("/sim/control-mode", "joystick");
-    fgSetBool("/sim/auto-coordination", false);
+    fgSetBool("/controls/flight/auto-coordination", false);
 #if defined(WIN32)
     fgSetString("/sim/startup/browser-app", "webrun.bat");
 #elif defined(__APPLE__)
@@ -1359,8 +1359,8 @@ struct OptionDesc {
     {"disable-anti-alias-hud",       false, OPTION_BOOL,   "/sim/hud/color/antialiased", false, "", 0 },
     {"enable-anti-alias-hud",        false, OPTION_BOOL,   "/sim/hud/color/antialiased", true, "", 0 },
     {"control",                      true,  OPTION_STRING, "/sim/control-mode", false, "", 0 },
-    {"disable-auto-coordination",    false, OPTION_BOOL,   "/sim/auto-coordination", false, "", 0 },
-    {"enable-auto-coordination",     false, OPTION_BOOL,   "/sim/auto-coordination", true, "", 0 },
+    {"disable-auto-coordination",    false, OPTION_BOOL,   "/controls/flight/auto-coordination", false, "", 0 },
+    {"enable-auto-coordination",     false, OPTION_BOOL,   "/controls/flight/auto-coordination", true, "", 0 },
     {"browser-app",                  true,  OPTION_STRING, "/sim/startup/browser-app", false, "", 0 },
     {"disable-hud",                  false, OPTION_BOOL,   "/sim/hud/visibility[1]", false, "", 0 },
     {"enable-hud",                   false, OPTION_BOOL,   "/sim/hud/visibility[1]", true, "", 0 },