// Constructor
FGControls::FGControls() :
- aileron( 0.0 ),
- aileron_trim( 0.0 ),
- elevator( 0.0 ),
- elevator_trim( 0.0 ),
- rudder( 0.0 ),
- rudder_trim( 0.0 ),
flaps( 0.0 ),
slats( 0.0 ),
- BLC( false ),
- spoilers( 0.0 ),
- speedbrake( 0.0 ),
- wing_sweep( 0.0 ),
- wing_fold( false ),
- drag_chute( false ),
- throttle_idle( true ),
- dump_valve( false ),
- brake_left( 0.0 ),
- brake_right( 0.0 ),
- copilot_brake_left( 0.0 ),
- copilot_brake_right( 0.0 ),
- brake_parking( 0.0 ),
- steering( 0.0 ),
- nose_wheel_steering( true ),
- gear_down( true ),
antiskid( true ),
tailhook( false ),
launchbar( false ),
- catapult_launch_cmd( false ),
tailwheel_lock( true ),
- wing_heat( false ),
- pitot_heat( true ),
- wiper( 0 ),
- window_heat( false ),
battery_switch( true ),
external_power( false ),
APU_generator( false ),
mode( 0 ),
dump( false ),
outflow_valve( 0.0 ),
- landing_lights( false ),
- turn_off_lights( false ),
taxi_light( false ),
logo_lights( false ),
nav_lights( false ),
panel_norm( 0.0 ),
instruments_norm( 0.0 ),
dome_norm( 0.0 ),
- master_arm( false ),
station_select( 1 ),
release_ALL( false ),
vertical_adjust( 0.0 ),
fore_aft_adjust( 0.0 ),
cmd_selector_valve( 0 ),
off_start_run( 0 ),
- APU_fire_switch( false ),
- autothrottle_arm( false ),
- autothrottle_engage( false ),
heading_select( 0.0 ),
altitude_select( 50000.0 ),
bank_angle_select( 30.0 ),
vertical_mode( 0 ),
lateral_mode( 0 )
{
+ 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 );
+ }
+
+ reset_all();
globals->set_controls( this );
}
autothrottle_arm = false;
autothrottle_engage = false;
set_autopilot_engage( ALL_AUTOPILOTS, false );
+
+ brake_left = brake_right
+ = copilot_brake_left = copilot_brake_right
+ = brake_parking = 0.0;
+
+ set_fuel_selector(ALL_TANKS, false);
+ set_to_engine(ALL_TANKS, 0);
+ set_to_tank(ALL_TANKS, 0);
+ set_boost_pump(ALL_TANKS, false);
+
+ set_alternate_extension(ALL_WHEELS, false);
+
+ set_mixture(ALL_ENGINES, 1.0);
+ set_prop_advance(ALL_ENGINES, 1.0);
+ set_generator_breaker(ALL_ENGINES, false);
+ set_bus_tie(ALL_ENGINES, false);
+ set_engine_bleed(ALL_ENGINES, false);
+ set_feed_tank(ALL_ENGINES, -1); // feed off
+ set_cowl_flaps_norm(ALL_ENGINES, 0.0);
}
void
FGControls::init ()
{
- throttle_idle = true;
- for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
- throttle[engine] = 0.0;
- mixture[engine] = 1.0;
- fuel_pump[engine] = false;
- prop_advance[engine] = 1.0;
- magnetos[engine] = 0;
- feed_tank[engine] = -1; // set to -1 to turn off all tanks 0 feeds all engines from center body tank
- starter[engine] = false;
- feather[engine] = false;
- ignition[engine] = false;
- fire_switch[engine] = false;
- fire_bottle_discharge[engine] = false;
- cutoff[engine] = true;
- augmentation[engine] = false;
- reverser[engine] = false;
- water_injection[engine] = false;
- nitrous_injection[engine] = false;
- cowl_flaps_norm[engine] = 0.0;
- condition[engine] = 1.0;
- carb_heat[engine] = false;
- inlet_heat[engine] = false;
- generator_breaker[engine] = false;
- bus_tie[engine] = false;
- engine_bleed[engine] = false;
- }
-
- for ( int tank = 0; tank < MAX_TANKS; tank++ ) {
- fuel_selector[tank] = false;
- to_engine[tank] = 0;
- to_tank[tank] = 0;
- }
-
- for( int pump = 0; pump < MAX_TANKS * MAX_BOOSTPUMPS; pump++ ) {
- boost_pump[pump] = false;
- }
-
- brake_left = brake_right
- = copilot_brake_left = copilot_brake_right
- = brake_parking = 0.0;
- for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
- alternate_extension[wheel] = false;
- }
+}
- 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 );
- }
+void
+FGControls::reinit()
+{
+ reset_all();
}
static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
void
FGControls::bind ()
{
- init(); // unfortunately, tie-ing requires init() to have occurred
+ reset_all();
int index, i;
// flight controls