1
0
Fork 0

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
This commit is contained in:
Torsten Dreyer 2012-03-13 21:00:22 +01:00
parent 60ffb950e2
commit 5caa42af8e
3 changed files with 20 additions and 14 deletions

View file

@ -215,7 +215,12 @@ FGControls::init ()
alternate_extension[wheel] = false; 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 ) static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
@ -656,11 +661,7 @@ FGControls::set_aileron (double pos)
{ {
aileron = pos; aileron = pos;
SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 ); SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
do_autocoordination();
// check for autocoordination
if ( auto_coordination->getBoolValue() ) {
set_rudder( aileron / 2.0 );
}
} }
void void
@ -668,11 +669,7 @@ FGControls::move_aileron (double amt)
{ {
aileron += amt; aileron += amt;
SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 ); SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
do_autocoordination();
// check for autocoordination
if ( auto_coordination->getBoolValue() ) {
set_rudder( aileron / 2.0 );
}
} }
void void

View file

@ -253,6 +253,7 @@ private:
SGPropertyNode_ptr auto_coordination; SGPropertyNode_ptr auto_coordination;
SGPropertyNode_ptr auto_coordination_factor;
simgear::TiedPropertyList _tiedProperties; simgear::TiedPropertyList _tiedProperties;
public: public:
@ -637,6 +638,14 @@ public:
// controls/autoflight/autopilot[n]/ // controls/autoflight/autopilot[n]/
void set_autopilot_engage( int ap, bool val ); 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 );
}
}
}; };

View file

@ -176,7 +176,7 @@ fgSetDefaults ()
// specified so we can do the right thing for voodoo-1/2 cards. // specified so we can do the right thing for voodoo-1/2 cards.
// fgSetString("/sim/startup/mouse-pointer", "disabled"); // fgSetString("/sim/startup/mouse-pointer", "disabled");
fgSetString("/sim/control-mode", "joystick"); fgSetString("/sim/control-mode", "joystick");
fgSetBool("/sim/auto-coordination", false); fgSetBool("/controls/flight/auto-coordination", false);
#if defined(WIN32) #if defined(WIN32)
fgSetString("/sim/startup/browser-app", "webrun.bat"); fgSetString("/sim/startup/browser-app", "webrun.bat");
#elif defined(__APPLE__) #elif defined(__APPLE__)
@ -1359,8 +1359,8 @@ struct OptionDesc {
{"disable-anti-alias-hud", false, OPTION_BOOL, "/sim/hud/color/antialiased", false, "", 0 }, {"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 }, {"enable-anti-alias-hud", false, OPTION_BOOL, "/sim/hud/color/antialiased", true, "", 0 },
{"control", true, OPTION_STRING, "/sim/control-mode", false, "", 0 }, {"control", true, OPTION_STRING, "/sim/control-mode", false, "", 0 },
{"disable-auto-coordination", false, OPTION_BOOL, "/sim/auto-coordination", false, "", 0 }, {"disable-auto-coordination", false, OPTION_BOOL, "/controls/flight/auto-coordination", false, "", 0 },
{"enable-auto-coordination", false, OPTION_BOOL, "/sim/auto-coordination", true, "", 0 }, {"enable-auto-coordination", false, OPTION_BOOL, "/controls/flight/auto-coordination", true, "", 0 },
{"browser-app", true, OPTION_STRING, "/sim/startup/browser-app", false, "", 0 }, {"browser-app", true, OPTION_STRING, "/sim/startup/browser-app", false, "", 0 },
{"disable-hud", false, OPTION_BOOL, "/sim/hud/visibility[1]", false, "", 0 }, {"disable-hud", false, OPTION_BOOL, "/sim/hud/visibility[1]", false, "", 0 },
{"enable-hud", false, OPTION_BOOL, "/sim/hud/visibility[1]", true, "", 0 }, {"enable-hud", false, OPTION_BOOL, "/sim/hud/visibility[1]", true, "", 0 },