From 5caa42af8ec6a8971aef37777640dbe449eda5cf Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Tue, 13 Mar 2012 21:00:22 +0100 Subject: [PATCH] Make use of auto-coordination more flexible - 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 | 19 ++++++++----------- src/Aircraft/controls.hxx | 9 +++++++++ src/Main/options.cxx | 6 +++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/Aircraft/controls.cxx b/src/Aircraft/controls.cxx index dcd4a553b..772ab8e74 100644 --- a/src/Aircraft/controls.cxx +++ b/src/Aircraft/controls.cxx @@ -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( 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( aileron, -1.0, 1.0 ); - - // check for autocoordination - if ( auto_coordination->getBoolValue() ) { - set_rudder( aileron / 2.0 ); - } + do_autocoordination(); } void diff --git a/src/Aircraft/controls.hxx b/src/Aircraft/controls.hxx index a738bc27f..cc8ce5a71 100644 --- a/src/Aircraft/controls.hxx +++ b/src/Aircraft/controls.hxx @@ -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 ); + } + } }; diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 2d18b736a..8d40329fb 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -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 }, -- 2.39.5