1 // controls.cxx -- defines a standard interface to all flight sim controls
3 // Written by Curtis Olson, started May 1997.
5 // Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <Main/fg_props.hxx>
28 #include <simgear/sg_inlines.h>
29 #include "controls.hxx"
31 ////////////////////////////////////////////////////////////////////////
32 // Implementation of FGControls.
33 ////////////////////////////////////////////////////////////////////////
36 FGControls::FGControls() :
51 throttle_idle( true ),
55 copilot_brake_left( 0.0 ),
56 copilot_brake_right( 0.0 ),
59 nose_wheel_steering( true ),
64 catapult_launch_cmd( false ),
65 tailwheel_lock( true ),
70 battery_switch( true ),
71 external_power( false ),
72 APU_generator( false ),
83 instruments_norm( 0.0 ),
88 vertical_adjust( 0.0 ),
89 fore_aft_adjust( 0.0 ),
91 APU_fire_switch( false ),
92 autothrottle_arm( false ),
93 autothrottle_engage( false ),
94 heading_select( 0.0 ),
95 altitude_select( 50000.0 ),
96 bank_angle_select( 30.0 ),
97 vertical_speed_select( 0.0 ),
103 globals->set_controls( this );
107 void FGControls::reset_all()
110 set_aileron_trim( 0.0 );
112 set_elevator_trim( 0.0 );
114 set_rudder_trim( 0.0 );
117 set_speedbrake( 0.0 );
118 set_wing_sweep( 0.0 );
121 set_throttle( ALL_ENGINES, 0.0 );
122 set_starter( ALL_ENGINES, false );
123 set_magnetos( ALL_ENGINES, 0 );
124 set_fuel_pump( ALL_ENGINES, false );
125 set_fire_switch( ALL_ENGINES, false );
126 set_fire_bottle_discharge( ALL_ENGINES, false );
127 set_cutoff( ALL_ENGINES, true );
128 set_nitrous_injection( ALL_ENGINES, false );
129 set_cowl_flaps_norm( ALL_ENGINES, 1.0 );
130 set_feather( ALL_ENGINES, false );
131 set_ignition( ALL_ENGINES, false );
132 set_augmentation( ALL_ENGINES, false );
133 set_reverser( ALL_ENGINES, false );
134 set_water_injection( ALL_ENGINES, false );
135 set_condition( ALL_ENGINES, 1.0 );
136 throttle_idle = true;
137 set_fuel_selector( ALL_TANKS, true );
140 nose_wheel_steering = true;
144 catapult_launch_cmd = false;
145 tailwheel_lock = true;
146 set_carb_heat( ALL_ENGINES, false );
147 set_inlet_heat( ALL_ENGINES, false );
152 set_engine_pump( ALL_HYD_SYSTEMS, true );
153 set_electric_pump( ALL_HYD_SYSTEMS, true );
154 landing_lights = false;
155 turn_off_lights = false;
157 set_ejection_seat( ALL_EJECTION_SEATS, false );
158 set_eseat_status( ALL_EJECTION_SEATS, SEAT_SAFED );
159 set_cmd_selector_valve( CMD_SEL_NORM );
160 APU_fire_switch = false;
161 autothrottle_arm = false;
162 autothrottle_engage = false;
163 set_autopilot_engage( ALL_AUTOPILOTS, false );
168 FGControls::~FGControls() {
175 throttle_idle = true;
176 for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
177 throttle[engine] = 0.0;
178 mixture[engine] = 1.0;
179 fuel_pump[engine] = false;
180 prop_advance[engine] = 1.0;
181 magnetos[engine] = 0;
182 feed_tank[engine] = -1; // set to -1 to turn off all tanks 0 feeds all engines from center body tank
183 starter[engine] = false;
184 feather[engine] = false;
185 ignition[engine] = false;
186 fire_switch[engine] = false;
187 fire_bottle_discharge[engine] = false;
188 cutoff[engine] = true;
189 augmentation[engine] = false;
190 reverser[engine] = false;
191 water_injection[engine] = false;
192 nitrous_injection[engine] = false;
193 cowl_flaps_norm[engine] = 0.0;
194 condition[engine] = 1.0;
195 carb_heat[engine] = false;
196 inlet_heat[engine] = false;
197 generator_breaker[engine] = false;
198 bus_tie[engine] = false;
199 engine_bleed[engine] = false;
202 for ( int tank = 0; tank < MAX_TANKS; tank++ ) {
203 fuel_selector[tank] = false;
208 for( int pump = 0; pump < MAX_TANKS * MAX_BOOSTPUMPS; pump++ ) {
209 boost_pump[pump] = false;
212 brake_left = brake_right
213 = copilot_brake_left = copilot_brake_right
214 = brake_parking = 0.0;
215 for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
216 alternate_extension[wheel] = false;
219 auto_coordination = fgGetNode("/controls/flight/auto-coordination", true);
220 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", false );
221 if( NULL == auto_coordination_factor ) {
222 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", true );
223 auto_coordination_factor->setDoubleValue( 0.5 );
227 static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
229 tiedProperties.setRoot( fgGetNode( root, index, true ) );
235 init(); // unfortunately, tie-ing requires init() to have occurred
239 _SetRoot( _tiedProperties, "/controls/flight" );
241 _tiedProperties.Tie( "aileron", this, &FGControls::get_aileron, &FGControls::set_aileron )
242 ->setAttribute( SGPropertyNode::ARCHIVE, true );
244 _tiedProperties.Tie( "aileron-trim", this, &FGControls::get_aileron_trim, &FGControls::set_aileron_trim )
245 ->setAttribute( SGPropertyNode::ARCHIVE, true );
247 _tiedProperties.Tie( "elevator", this, &FGControls::get_elevator, &FGControls::set_elevator )
248 ->setAttribute( SGPropertyNode::ARCHIVE, true );
250 _tiedProperties.Tie( "elevator-trim", this, &FGControls::get_elevator_trim, &FGControls::set_elevator_trim )
251 ->setAttribute( SGPropertyNode::ARCHIVE, true );
253 _tiedProperties.Tie( "rudder", this, &FGControls::get_rudder, &FGControls::set_rudder )
254 ->setAttribute( SGPropertyNode::ARCHIVE, true );
256 _tiedProperties.Tie( "rudder-trim", this, &FGControls::get_rudder_trim, &FGControls::set_rudder_trim )
257 ->setAttribute( SGPropertyNode::ARCHIVE, true );
259 _tiedProperties.Tie( "flaps", this, &FGControls::get_flaps, &FGControls::set_flaps )
260 ->setAttribute( SGPropertyNode::ARCHIVE, true );
262 _tiedProperties.Tie( "slats", this, &FGControls::get_slats, &FGControls::set_slats )
263 ->setAttribute( SGPropertyNode::ARCHIVE, true );
265 _tiedProperties.Tie( "BLC", this, &FGControls::get_BLC, &FGControls::set_BLC )
266 ->setAttribute( SGPropertyNode::ARCHIVE, true );
268 _tiedProperties.Tie( "spoilers", this, &FGControls::get_spoilers, &FGControls::set_spoilers )
269 ->setAttribute( SGPropertyNode::ARCHIVE, true );
271 _tiedProperties.Tie( "speedbrake", this, &FGControls::get_speedbrake, &FGControls::set_speedbrake )
272 ->setAttribute( SGPropertyNode::ARCHIVE, true );
274 _tiedProperties.Tie( "wing-sweep", this, &FGControls::get_wing_sweep, &FGControls::set_wing_sweep )
275 ->setAttribute( SGPropertyNode::ARCHIVE, true );
277 _tiedProperties.Tie( "wing-fold", this, &FGControls::get_wing_fold, &FGControls::set_wing_fold )
278 ->setAttribute( SGPropertyNode::ARCHIVE, true );
280 _tiedProperties.Tie( "drag-chute", this, &FGControls::get_drag_chute, &FGControls::set_drag_chute )
281 ->setAttribute( SGPropertyNode::ARCHIVE, true );
284 _tiedProperties.setRoot( fgGetNode("/controls/engines", true ) );
286 _tiedProperties.Tie( "throttle_idle", this, &FGControls::get_throttle_idle, &FGControls::set_throttle_idle )
287 ->setAttribute( SGPropertyNode::ARCHIVE, true );
289 for (index = 0; index < MAX_ENGINES; index++) {
290 _SetRoot(_tiedProperties, "/controls/engines/engine", index );
292 _tiedProperties.Tie( "throttle", this, index, &FGControls::get_throttle, &FGControls::set_throttle )
293 ->setAttribute( SGPropertyNode::ARCHIVE, true );
295 _tiedProperties.Tie( "starter", this, index, &FGControls::get_starter, &FGControls::set_starter )
296 ->setAttribute( SGPropertyNode::ARCHIVE, true );
298 _tiedProperties.Tie( "fuel-pump", this, index, &FGControls::get_fuel_pump, &FGControls::set_fuel_pump )
299 ->setAttribute( SGPropertyNode::ARCHIVE, true );
301 _tiedProperties.Tie( "fire-switch", this, index, &FGControls::get_fire_switch, &FGControls::set_fire_switch )
302 ->setAttribute( SGPropertyNode::ARCHIVE, true );
304 _tiedProperties.Tie( "fire-bottle-discharge", this, index, &FGControls::get_fire_bottle_discharge, &FGControls::set_fire_bottle_discharge )
305 ->setAttribute( SGPropertyNode::ARCHIVE, true );
307 _tiedProperties.Tie( "cutoff", this, index, &FGControls::get_cutoff, &FGControls::set_cutoff )
308 ->setAttribute( SGPropertyNode::ARCHIVE, true );
310 _tiedProperties.Tie( "mixture", this, index, &FGControls::get_mixture, &FGControls::set_mixture )
311 ->setAttribute( SGPropertyNode::ARCHIVE, true );
313 _tiedProperties.Tie( "propeller-pitch", this, index, &FGControls::get_prop_advance, &FGControls::set_prop_advance )
314 ->setAttribute( SGPropertyNode::ARCHIVE, true );
316 _tiedProperties.Tie( "magnetos", this, index, &FGControls::get_magnetos, &FGControls::set_magnetos )
317 ->setAttribute( SGPropertyNode::ARCHIVE, true );
319 _tiedProperties.Tie( "feed_tank", this, index, &FGControls::get_feed_tank, &FGControls::set_feed_tank )
320 ->setAttribute( SGPropertyNode::ARCHIVE, true );
322 _tiedProperties.Tie( "WEP", this, index, &FGControls::get_nitrous_injection, &FGControls::set_nitrous_injection )
323 ->setAttribute( SGPropertyNode::ARCHIVE, true );
325 _tiedProperties.Tie( "cowl-flaps-norm", this, index, &FGControls::get_cowl_flaps_norm, &FGControls::set_cowl_flaps_norm )
326 ->setAttribute( SGPropertyNode::ARCHIVE, true );
328 _tiedProperties.Tie( "propeller-feather", this, index, &FGControls::get_feather, &FGControls::set_feather )
329 ->setAttribute( SGPropertyNode::ARCHIVE, true );
331 _tiedProperties.Tie( "ignition", this, index, &FGControls::get_ignition, &FGControls::set_ignition )
332 ->setAttribute( SGPropertyNode::ARCHIVE, true );
334 _tiedProperties.Tie( "augmentation", this, index, &FGControls::get_augmentation, &FGControls::set_augmentation )
335 ->setAttribute( SGPropertyNode::ARCHIVE, true );
337 _tiedProperties.Tie( "reverser", this, index, &FGControls::get_reverser, &FGControls::set_reverser )
338 ->setAttribute( SGPropertyNode::ARCHIVE, true );
340 _tiedProperties.Tie( "water-injection", this, index, &FGControls::get_water_injection, &FGControls::set_water_injection )
341 ->setAttribute( SGPropertyNode::ARCHIVE, true );
343 _tiedProperties.Tie( "condition", this, index, &FGControls::get_condition, &FGControls::set_condition )
344 ->setAttribute( SGPropertyNode::ARCHIVE, true );
348 _SetRoot( _tiedProperties, "/controls/fuel" );
350 _tiedProperties.Tie( "dump-valve", this, &FGControls::get_dump_valve, &FGControls::set_dump_valve)
351 ->setAttribute( SGPropertyNode::ARCHIVE, true );
353 for (index = 0; index < MAX_TANKS; index++) {
354 _SetRoot( _tiedProperties, "/controls/fuel/tank", index );
356 _tiedProperties.Tie( "fuel_selector", this, index, &FGControls::get_fuel_selector, &FGControls::set_fuel_selector)
357 ->setAttribute( SGPropertyNode::ARCHIVE, true );
359 _tiedProperties.Tie( "to_engine", this, index, &FGControls::get_to_engine, &FGControls::set_to_engine)
360 ->setAttribute( SGPropertyNode::ARCHIVE, true );
362 _tiedProperties.Tie( "to_tank", this, index, &FGControls::get_to_tank, &FGControls::set_to_tank)
363 ->setAttribute( SGPropertyNode::ARCHIVE, true );
365 for (i = 0; i < MAX_BOOSTPUMPS; i++) {
366 _tiedProperties.Tie( "boost-pump", i,
367 this, index * 2 + i, &FGControls::get_boost_pump, &FGControls::set_boost_pump)
368 ->setAttribute( SGPropertyNode::ARCHIVE, true );
373 _SetRoot( _tiedProperties, "/controls/gear" );
375 _tiedProperties.Tie( "brake-left", this, &FGControls::get_brake_left, &FGControls::set_brake_left)
376 ->setAttribute( SGPropertyNode::ARCHIVE, true );
378 _tiedProperties.Tie( "brake-right", this, &FGControls::get_brake_right, &FGControls::set_brake_right)
379 ->setAttribute( SGPropertyNode::ARCHIVE, true );
381 _tiedProperties.Tie( "copilot-brake-left", this, &FGControls::get_copilot_brake_left, &FGControls::set_copilot_brake_left)
382 ->setAttribute( SGPropertyNode::ARCHIVE, true );
384 _tiedProperties.Tie( "copilot-brake-right", this, &FGControls::get_copilot_brake_right, &FGControls::set_copilot_brake_right)
385 ->setAttribute( SGPropertyNode::ARCHIVE, true );
387 _tiedProperties.Tie( "brake-parking", this, &FGControls::get_brake_parking, &FGControls::set_brake_parking)
388 ->setAttribute( SGPropertyNode::ARCHIVE, true );
390 _tiedProperties.Tie( "steering", this, &FGControls::get_steering, &FGControls::set_steering)
391 ->setAttribute( SGPropertyNode::ARCHIVE, true );
393 _tiedProperties.Tie( "nose-wheel-steering", this, &FGControls::get_nose_wheel_steering, &FGControls::set_nose_wheel_steering)
394 ->setAttribute( SGPropertyNode::ARCHIVE, true );
396 _tiedProperties.Tie( "gear-down", this, &FGControls::get_gear_down, &FGControls::set_gear_down)
397 ->setAttribute( SGPropertyNode::ARCHIVE, true );
399 _tiedProperties.Tie( "antiskid", this, &FGControls::get_antiskid, &FGControls::set_antiskid)
400 ->setAttribute( SGPropertyNode::ARCHIVE, true );
402 _tiedProperties.Tie( "tailhook", this, &FGControls::get_tailhook, &FGControls::set_tailhook)
403 ->setAttribute( SGPropertyNode::ARCHIVE, true );
405 _tiedProperties.Tie( "launchbar", this, &FGControls::get_launchbar, &FGControls::set_launchbar)
406 ->setAttribute( SGPropertyNode::ARCHIVE, true );
408 _tiedProperties.Tie( "catapult-launch-cmd", this, &FGControls::get_catapult_launch_cmd, &FGControls::set_catapult_launch_cmd)
409 ->setAttribute( SGPropertyNode::ARCHIVE, true );
411 _tiedProperties.Tie( "tailwheel-lock", this, &FGControls::get_tailwheel_lock, &FGControls::set_tailwheel_lock)
412 ->setAttribute( SGPropertyNode::ARCHIVE, true );
414 for (index = 0; index < MAX_WHEELS; index++) {
415 _SetRoot( _tiedProperties, "/controls/gear/wheel", index );
416 _tiedProperties.Tie( "alternate-extension", this, index, &FGControls::get_alternate_extension, &FGControls::set_alternate_extension)
417 ->setAttribute( SGPropertyNode::ARCHIVE, true );
421 _SetRoot( _tiedProperties, "/controls/anti-ice" );
423 _tiedProperties.Tie( "wing-heat", this, &FGControls::get_wing_heat, &FGControls::set_wing_heat)
424 ->setAttribute( SGPropertyNode::ARCHIVE, true );
426 _tiedProperties.Tie( "pitot-heat", this, &FGControls::get_pitot_heat, &FGControls::set_pitot_heat)
427 ->setAttribute( SGPropertyNode::ARCHIVE, true );
429 _tiedProperties.Tie( "wiper", this, &FGControls::get_wiper, &FGControls::set_wiper)
430 ->setAttribute( SGPropertyNode::ARCHIVE, true );
432 _tiedProperties.Tie( "window-heat", this, &FGControls::get_window_heat, &FGControls::set_window_heat)
433 ->setAttribute( SGPropertyNode::ARCHIVE, true );
435 for (index = 0; index < MAX_ENGINES; index++) {
436 _SetRoot( _tiedProperties, "/controls/anti-ice/engine", index );
438 _tiedProperties.Tie( "carb-heat", this, index, &FGControls::get_carb_heat, &FGControls::set_carb_heat)
439 ->setAttribute( SGPropertyNode::ARCHIVE, true );
441 _tiedProperties.Tie( "inlet-heat", this, index, &FGControls::get_inlet_heat, &FGControls::set_inlet_heat)
442 ->setAttribute( SGPropertyNode::ARCHIVE, true );
446 for (index = 0; index < MAX_HYD_SYSTEMS; index++) {
447 _SetRoot( _tiedProperties, "/controls/hydraulic/system", index );
449 _tiedProperties.Tie( "engine-pump", this, index, &FGControls::get_engine_pump, &FGControls::set_engine_pump)
450 ->setAttribute( SGPropertyNode::ARCHIVE, true );
452 _tiedProperties.Tie( "electric-pump", this, index, &FGControls::get_electric_pump, &FGControls::set_electric_pump)
453 ->setAttribute( SGPropertyNode::ARCHIVE, true );
457 _SetRoot( _tiedProperties, "/controls/electric" );
459 _tiedProperties.Tie( "battery-switch", this, &FGControls::get_battery_switch, &FGControls::set_battery_switch)
460 ->setAttribute( SGPropertyNode::ARCHIVE, true );
462 _tiedProperties.Tie( "external-power", this, &FGControls::get_external_power, &FGControls::set_external_power)
463 ->setAttribute( SGPropertyNode::ARCHIVE, true );
465 _tiedProperties.Tie( "APU-generator", this, &FGControls::get_APU_generator, &FGControls::set_APU_generator)
466 ->setAttribute( SGPropertyNode::ARCHIVE, true );
468 for (index = 0; index < MAX_ENGINES; index++) {
469 _SetRoot( _tiedProperties, "/controls/electric/engine", index );
471 _tiedProperties.Tie( "generator", this, index, &FGControls::get_generator_breaker, &FGControls::set_generator_breaker)
472 ->setAttribute( SGPropertyNode::ARCHIVE, true );
474 _tiedProperties.Tie( "bus-tie", this, index, &FGControls::get_bus_tie, &FGControls::set_bus_tie)
475 ->setAttribute( SGPropertyNode::ARCHIVE, true );
479 _SetRoot( _tiedProperties, "/controls/pneumatic" );
481 _tiedProperties.Tie( "APU-bleed", this, &FGControls::get_APU_bleed, &FGControls::set_APU_bleed)
482 ->setAttribute( SGPropertyNode::ARCHIVE, true );
484 for (index = 0; index < MAX_ENGINES; index++) {
485 _SetRoot( _tiedProperties, "/controls/pneumatic/engine", index );
487 _tiedProperties.Tie( "bleed", this, index, &FGControls::get_engine_bleed, &FGControls::set_engine_bleed)
488 ->setAttribute( SGPropertyNode::ARCHIVE, true );
492 _SetRoot( _tiedProperties, "/controls/pressurization" );
494 _tiedProperties.Tie( "mode", this, &FGControls::get_mode, &FGControls::set_mode)
495 ->setAttribute( SGPropertyNode::ARCHIVE, true );
497 _tiedProperties.Tie( "dump", this, &FGControls::get_dump, &FGControls::set_dump)
498 ->setAttribute( SGPropertyNode::ARCHIVE, true );
500 _tiedProperties.Tie( "outflow-valve", this, &FGControls::get_outflow_valve, &FGControls::set_outflow_valve)
501 ->setAttribute( SGPropertyNode::ARCHIVE, true );
503 for (index = 0; index < MAX_PACKS; index++) {
504 _SetRoot( _tiedProperties, "/controls/pressurization/pack", index );
506 _tiedProperties.Tie( "pack-on", this, index, &FGControls::get_pack_on, &FGControls::set_pack_on)
507 ->setAttribute( SGPropertyNode::ARCHIVE, true );
511 _SetRoot( _tiedProperties, "/controls/lighting" );
513 _tiedProperties.Tie( "landing-lights", this, &FGControls::get_landing_lights, &FGControls::set_landing_lights)
514 ->setAttribute( SGPropertyNode::ARCHIVE, true );
516 _tiedProperties.Tie( "turn-off-lights", this, &FGControls::get_turn_off_lights, &FGControls::set_turn_off_lights)
517 ->setAttribute( SGPropertyNode::ARCHIVE, true );
519 _tiedProperties.Tie( "taxi-light", this, &FGControls::get_taxi_light, &FGControls::set_taxi_light)
520 ->setAttribute( SGPropertyNode::ARCHIVE, true );
522 _tiedProperties.Tie( "logo-lights", this, &FGControls::get_logo_lights, &FGControls::set_logo_lights)
523 ->setAttribute( SGPropertyNode::ARCHIVE, true );
525 _tiedProperties.Tie( "nav-lights", this, &FGControls::get_nav_lights, &FGControls::set_nav_lights)
526 ->setAttribute( SGPropertyNode::ARCHIVE, true );
528 _tiedProperties.Tie( "beacon", this, &FGControls::get_beacon, &FGControls::set_beacon)
529 ->setAttribute( SGPropertyNode::ARCHIVE, true );
531 _tiedProperties.Tie( "strobe", this, &FGControls::get_strobe, &FGControls::set_strobe)
532 ->setAttribute( SGPropertyNode::ARCHIVE, true );
534 _tiedProperties.Tie( "panel-norm", this, &FGControls::get_panel_norm, &FGControls::set_panel_norm)
535 ->setAttribute( SGPropertyNode::ARCHIVE, true );
537 _tiedProperties.Tie( "instruments-norm", this, &FGControls::get_instruments_norm, &FGControls::set_instruments_norm)
538 ->setAttribute( SGPropertyNode::ARCHIVE, true );
540 _tiedProperties.Tie( "dome-norm", this, &FGControls::get_dome_norm, &FGControls::set_dome_norm)
541 ->setAttribute( SGPropertyNode::ARCHIVE, true );
544 _SetRoot( _tiedProperties, "/controls/armament" );
546 _tiedProperties.Tie( "master-arm", this, &FGControls::get_master_arm, &FGControls::set_master_arm)
547 ->setAttribute( SGPropertyNode::ARCHIVE, true );
549 _tiedProperties.Tie( "station-select", this, &FGControls::get_station_select, &FGControls::set_station_select)
550 ->setAttribute( SGPropertyNode::ARCHIVE, true );
552 _tiedProperties.Tie( "release-all", this, &FGControls::get_release_ALL, &FGControls::set_release_ALL)
553 ->setAttribute( SGPropertyNode::ARCHIVE, true );
555 for (index = 0; index < MAX_STATIONS; index++) {
556 _SetRoot( _tiedProperties, "/controls/armament/station", index );
558 _tiedProperties.Tie( "stick-size", this, index, &FGControls::get_stick_size, &FGControls::set_stick_size)
559 ->setAttribute( SGPropertyNode::ARCHIVE, true );
561 _tiedProperties.Tie( "release-stick", this, index, &FGControls::get_release_stick, &FGControls::set_release_stick)
562 ->setAttribute( SGPropertyNode::ARCHIVE, true );
564 _tiedProperties.Tie( "release-all", this, index, &FGControls::get_release_all, &FGControls::set_release_all)
565 ->setAttribute( SGPropertyNode::ARCHIVE, true );
567 _tiedProperties.Tie( "jettison-all", this, index, &FGControls::get_jettison_all, &FGControls::set_jettison_all)
568 ->setAttribute( SGPropertyNode::ARCHIVE, true );
572 _SetRoot( _tiedProperties, "/controls/seat" );
574 _tiedProperties.Tie( "vertical-adjust", this, &FGControls::get_vertical_adjust, &FGControls::set_vertical_adjust)
575 ->setAttribute( SGPropertyNode::ARCHIVE, true );
577 _tiedProperties.Tie( "fore-aft-adjust", this, &FGControls::get_fore_aft_adjust, &FGControls::set_fore_aft_adjust)
578 ->setAttribute( SGPropertyNode::ARCHIVE, true );
580 _tiedProperties.Tie( "cmd_selector_valve", this, &FGControls::get_cmd_selector_valve, &FGControls::set_cmd_selector_valve)
581 ->setAttribute( SGPropertyNode::ARCHIVE, true );
583 for (index = 0; index < MAX_EJECTION_SEATS; index++) {
584 _SetRoot( _tiedProperties, "/controls/seat/eject", index );
586 _tiedProperties.Tie( "initiate", this, index, &FGControls::get_ejection_seat, &FGControls::set_ejection_seat)
587 ->setAttribute( SGPropertyNode::ARCHIVE, true );
589 _tiedProperties.Tie( "status", this, index, &FGControls::get_eseat_status, &FGControls::set_eseat_status)
590 ->setAttribute( SGPropertyNode::ARCHIVE, true );
594 _SetRoot( _tiedProperties, "/controls/APU" );
596 _tiedProperties.Tie( "off-start-run", this, &FGControls::get_off_start_run, &FGControls::set_off_start_run)
597 ->setAttribute( SGPropertyNode::ARCHIVE, true );
599 _tiedProperties.Tie( "fire-switch", this, &FGControls::get_APU_fire_switch, &FGControls::set_APU_fire_switch)
600 ->setAttribute( SGPropertyNode::ARCHIVE, true );
603 for (index = 0; index < MAX_AUTOPILOTS; index++) {
605 _SetRoot( _tiedProperties, "/controls/autoflight/autopilot", index );
607 _tiedProperties.Tie( "engage", this, index, &FGControls::get_autopilot_engage, &FGControls::set_autopilot_engage)
608 ->setAttribute( SGPropertyNode::ARCHIVE, true );
611 _SetRoot( _tiedProperties, "/controls/autoflight/" );
613 _tiedProperties.Tie( "autothrottle-arm", this, &FGControls::get_autothrottle_arm, &FGControls::set_autothrottle_arm)
614 ->setAttribute( SGPropertyNode::ARCHIVE, true );
616 _tiedProperties.Tie( "autothrottle-engage", this, &FGControls::get_autothrottle_engage, &FGControls::set_autothrottle_engage)
617 ->setAttribute( SGPropertyNode::ARCHIVE, true );
619 _tiedProperties.Tie( "heading-select", this, &FGControls::get_heading_select, &FGControls::set_heading_select)
620 ->setAttribute( SGPropertyNode::ARCHIVE, true );
622 _tiedProperties.Tie( "altitude-select", this, &FGControls::get_altitude_select, &FGControls::set_altitude_select)
623 ->setAttribute( SGPropertyNode::ARCHIVE, true );
625 _tiedProperties.Tie( "bank-angle-select", this, &FGControls::get_bank_angle_select, &FGControls::set_bank_angle_select)
626 ->setAttribute( SGPropertyNode::ARCHIVE, true );
628 _tiedProperties.Tie( "vertical-speed-select", this, &FGControls::get_vertical_speed_select, &FGControls::set_vertical_speed_select)
629 ->setAttribute( SGPropertyNode::ARCHIVE, true );
631 _tiedProperties.Tie( "speed-select", this, &FGControls::get_speed_select, &FGControls::set_speed_select)
632 ->setAttribute( SGPropertyNode::ARCHIVE, true );
634 _tiedProperties.Tie( "mach-select", this, &FGControls::get_mach_select, &FGControls::set_mach_select)
635 ->setAttribute( SGPropertyNode::ARCHIVE, true );
637 _tiedProperties.Tie( "vertical-mode", this, &FGControls::get_vertical_mode, &FGControls::set_vertical_mode)
638 ->setAttribute( SGPropertyNode::ARCHIVE, true );
640 _tiedProperties.Tie( "lateral-mode", this, &FGControls::get_lateral_mode, &FGControls::set_lateral_mode)
641 ->setAttribute( SGPropertyNode::ARCHIVE, true );
644 void FGControls::unbind ()
646 _tiedProperties.Untie();
651 FGControls::update (double dt)
656 ////////////////////////////////////////////////////////////////////////
657 // Setters and adjusters.
658 ////////////////////////////////////////////////////////////////////////
661 FGControls::set_aileron (double pos)
664 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
665 do_autocoordination();
669 FGControls::move_aileron (double amt)
672 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
673 do_autocoordination();
677 FGControls::set_aileron_trim( double pos )
680 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
684 FGControls::move_aileron_trim( double amt )
687 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
691 FGControls::set_elevator( double pos )
694 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
698 FGControls::move_elevator( double amt )
701 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
705 FGControls::set_elevator_trim( double pos )
708 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
712 FGControls::move_elevator_trim( double amt )
714 elevator_trim += amt;
715 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
719 FGControls::set_rudder( double pos )
722 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
726 FGControls::move_rudder( double amt )
729 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
733 FGControls::set_rudder_trim( double pos )
736 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
740 FGControls::move_rudder_trim( double amt )
743 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
747 FGControls::set_flaps( double pos )
750 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
754 FGControls::move_flaps( double amt )
757 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
761 FGControls::set_slats( double pos )
764 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
768 FGControls::move_slats( double amt )
771 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
775 FGControls::set_BLC( bool val )
781 FGControls::set_spoilers( double pos )
784 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
788 FGControls::move_spoilers( double amt )
791 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
795 FGControls::set_speedbrake( double pos )
798 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
802 FGControls::move_speedbrake( double amt )
805 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
809 FGControls::set_wing_sweep( double pos )
812 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
816 FGControls::move_wing_sweep( double amt )
819 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
823 FGControls::set_wing_fold( bool val )
829 FGControls::set_drag_chute( bool val )
835 FGControls::set_throttle_idle( bool val )
841 FGControls::set_throttle( int engine, double pos )
843 if ( engine == ALL_ENGINES ) {
844 for ( int i = 0; i < MAX_ENGINES; i++ ) {
846 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
849 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
850 throttle[engine] = pos;
851 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
857 FGControls::move_throttle( int engine, double amt )
859 if ( engine == ALL_ENGINES ) {
860 for ( int i = 0; i < MAX_ENGINES; i++ ) {
862 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
865 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
866 throttle[engine] += amt;
867 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
873 FGControls::set_starter( int engine, bool flag )
875 if ( engine == ALL_ENGINES ) {
876 for ( int i = 0; i < MAX_ENGINES; i++ ) {
880 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
881 starter[engine] = flag;
887 FGControls::set_fuel_pump( int engine, bool val )
889 if ( engine == ALL_ENGINES ) {
890 for ( int i = 0; i < MAX_ENGINES; i++ ) {
894 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
895 fuel_pump[engine] = val;
901 FGControls::set_fire_switch( int engine, bool val )
903 if ( engine == ALL_ENGINES ) {
904 for ( int i = 0; i < MAX_ENGINES; i++ ) {
905 fire_switch[i] = val;
908 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
909 fire_switch[engine] = val;
915 FGControls::set_fire_bottle_discharge( int engine, bool val )
917 if ( engine == ALL_ENGINES ) {
918 for ( int i = 0; i < MAX_ENGINES; i++ ) {
919 fire_bottle_discharge[i] = val;
922 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
923 fire_bottle_discharge[engine] = val;
929 FGControls::set_cutoff( int engine, bool val )
931 if ( engine == ALL_ENGINES ) {
932 for ( int i = 0; i < MAX_ENGINES; i++ ) {
936 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
937 cutoff[engine] = val;
943 FGControls::set_feed_tank( int engine, int tank )
945 if ( engine == ALL_ENGINES ) {
946 for ( int i = 0; i < MAX_ENGINES; i++ ) {
948 SG_CLAMP_RANGE<int>( feed_tank[i], -1, 4 );
951 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
952 feed_tank[engine] = tank;
953 SG_CLAMP_RANGE<int>( feed_tank[engine], -1, 4 );
956 // feed_tank[engine] = engine;
961 FGControls::set_mixture( int engine, double pos )
963 if ( engine == ALL_ENGINES ) {
964 for ( int i = 0; i < MAX_ENGINES; i++ ) {
966 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
969 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
970 mixture[engine] = pos;
971 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
977 FGControls::move_mixture( int engine, double amt )
979 if ( engine == ALL_ENGINES ) {
980 for ( int i = 0; i < MAX_ENGINES; i++ ) {
982 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
985 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
986 mixture[engine] += amt;
987 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
993 FGControls::set_prop_advance( int engine, double pos )
995 if ( engine == ALL_ENGINES ) {
996 for ( int i = 0; i < MAX_ENGINES; i++ ) {
997 prop_advance[i] = pos;
998 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1001 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1002 prop_advance[engine] = pos;
1003 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1009 FGControls::move_prop_advance( int engine, double amt )
1011 if ( engine == ALL_ENGINES ) {
1012 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1013 prop_advance[i] += amt;
1014 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1017 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1018 prop_advance[engine] += amt;
1019 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1025 FGControls::set_magnetos( int engine, int pos )
1027 if ( engine == ALL_ENGINES ) {
1028 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1030 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1033 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1034 magnetos[engine] = pos;
1035 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1041 FGControls::move_magnetos( int engine, int amt )
1043 if ( engine == ALL_ENGINES ) {
1044 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1046 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1049 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1050 magnetos[engine] += amt;
1051 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1057 FGControls::set_nitrous_injection( int engine, bool val )
1059 if ( engine == ALL_ENGINES ) {
1060 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1061 nitrous_injection[i] = val;
1064 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1065 nitrous_injection[engine] = val;
1072 FGControls::set_cowl_flaps_norm( int engine, double pos )
1074 if ( engine == ALL_ENGINES ) {
1075 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1076 cowl_flaps_norm[i] = pos;
1077 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1080 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1081 cowl_flaps_norm[engine] = pos;
1082 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1088 FGControls::move_cowl_flaps_norm( int engine, double amt )
1090 if ( engine == ALL_ENGINES ) {
1091 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1092 cowl_flaps_norm[i] += amt;
1093 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1096 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1097 cowl_flaps_norm[engine] += amt;
1098 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1104 FGControls::set_feather( int engine, bool val )
1106 if ( engine == ALL_ENGINES ) {
1107 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1111 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1112 feather[engine] = val;
1118 FGControls::set_ignition( int engine, int pos )
1120 if ( engine == ALL_ENGINES ) {
1121 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1123 SG_CLAMP_RANGE<int>( ignition[i], 0, 3 );
1126 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1127 ignition[engine] = pos;
1128 SG_CLAMP_RANGE<int>( ignition[engine], 0, 3 );
1134 FGControls::set_augmentation( int engine, bool val )
1136 if ( engine == ALL_ENGINES ) {
1137 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1138 augmentation[i] = val;
1141 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1142 augmentation[engine] = val;
1148 FGControls::set_reverser( int engine, bool val )
1150 if ( engine == ALL_ENGINES ) {
1151 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1155 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1156 reverser[engine] = val;
1162 FGControls::set_water_injection( int engine, bool val )
1164 if ( engine == ALL_ENGINES ) {
1165 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1166 water_injection[i] = val;
1169 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1170 water_injection[engine] = val;
1176 FGControls::set_condition( int engine, double val )
1178 if ( engine == ALL_ENGINES ) {
1179 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1181 SG_CLAMP_RANGE<double>( condition[i], 0.0, 1.0 );
1184 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1185 condition[engine] = val;
1186 SG_CLAMP_RANGE<double>( condition[engine], 0.0, 1.0 );
1192 FGControls::set_dump_valve( bool val )
1199 FGControls::set_fuel_selector( int tank, bool pos )
1201 if ( tank == ALL_TANKS ) {
1202 for ( int i = 0; i < MAX_TANKS; i++ ) {
1203 fuel_selector[i] = pos;
1206 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1207 fuel_selector[tank] = pos;
1213 FGControls::set_to_engine( int tank, int engine )
1215 if ( tank == ALL_TANKS ) {
1216 for ( int i = 0; i < MAX_TANKS; i++ ) {
1217 to_engine[i] = engine;
1220 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1221 to_engine[tank] = engine;
1227 FGControls::set_to_tank( int tank, int dest_tank )
1229 if ( tank == ALL_TANKS ) {
1230 for ( int i = 0; i < MAX_TANKS; i++ ) {
1231 to_tank[i] = dest_tank;
1234 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1235 to_tank[tank] = dest_tank;
1241 FGControls::set_boost_pump( int index, bool val )
1243 if ( index == -1 ) {
1244 for ( int i = 0; i < (MAX_TANKS * MAX_BOOSTPUMPS); i++ ) {
1245 boost_pump[i] = val;
1248 if ( (index >= 0) && (index < (MAX_TANKS * MAX_BOOSTPUMPS)) ) {
1249 boost_pump[index] = val;
1256 FGControls::set_brake_left( double pos )
1259 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1263 FGControls::move_brake_left( double amt )
1266 SG_CLAMP_RANGE<double>( brake_left, 0.0, 1.0 );
1270 FGControls::set_brake_right( double pos )
1273 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1277 FGControls::move_brake_right( double amt )
1280 SG_CLAMP_RANGE<double>( brake_right, 0.0, 1.0 );
1284 FGControls::set_copilot_brake_left( double pos )
1286 copilot_brake_left = pos;
1287 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1291 FGControls::set_copilot_brake_right( double pos )
1293 copilot_brake_right = pos;
1294 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1298 FGControls::set_brake_parking( double pos )
1300 brake_parking = pos;
1301 SG_CLAMP_RANGE<double>(brake_parking, 0.0, 1.0);
1305 FGControls::set_steering( double angle )
1308 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1312 FGControls::set_nose_wheel_steering( bool nws )
1314 nose_wheel_steering = nws;
1318 FGControls::move_steering( double angle )
1321 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1325 FGControls::set_gear_down( bool gear )
1331 FGControls::set_antiskid( bool state )
1337 FGControls::set_tailhook( bool state )
1343 FGControls::set_launchbar( bool state )
1349 FGControls::set_catapult_launch_cmd( bool state )
1351 catapult_launch_cmd = state;
1355 FGControls::set_tailwheel_lock( bool state )
1357 tailwheel_lock = state;
1362 FGControls::set_alternate_extension( int wheel, bool val )
1364 if ( wheel == ALL_WHEELS ) {
1365 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1366 alternate_extension[i] = val;
1369 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1370 alternate_extension[wheel] = val;
1376 FGControls::set_wing_heat( bool state )
1382 FGControls::set_pitot_heat( bool state )
1388 FGControls::set_wiper( int state )
1394 FGControls::set_window_heat( bool state )
1396 window_heat = state;
1400 FGControls::set_carb_heat( int engine, bool val )
1402 if ( engine == ALL_ENGINES ) {
1403 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1407 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1408 carb_heat[engine] = val;
1414 FGControls::set_inlet_heat( int engine, bool val )
1416 if ( engine == ALL_ENGINES ) {
1417 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1418 inlet_heat[i] = val;
1421 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1422 inlet_heat[engine] = val;
1428 FGControls::set_engine_pump( int system, bool val )
1430 if ( system == ALL_HYD_SYSTEMS ) {
1431 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1432 engine_pump[i] = val;
1435 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1436 engine_pump[system] = val;
1442 FGControls::set_electric_pump( int system, bool val )
1444 if ( system == ALL_HYD_SYSTEMS ) {
1445 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1446 electric_pump[i] = val;
1449 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1450 electric_pump[system] = val;
1456 FGControls::set_battery_switch( bool state )
1458 battery_switch = state;
1462 FGControls::set_external_power( bool state )
1464 external_power = state;
1468 FGControls::set_APU_generator( bool state )
1470 APU_generator = state;
1474 FGControls::set_generator_breaker( int engine, bool val )
1476 if ( engine == ALL_ENGINES ) {
1477 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1478 generator_breaker[i] = val;
1481 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1482 generator_breaker[engine] = val;
1488 FGControls::set_bus_tie( int engine, bool val )
1490 if ( engine == ALL_ENGINES ) {
1491 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1495 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1496 bus_tie[engine] = val;
1502 FGControls::set_APU_bleed( bool state )
1508 FGControls::set_engine_bleed( int engine, bool val )
1510 if ( engine == ALL_ENGINES ) {
1511 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1512 engine_bleed[i] = val;
1515 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1516 engine_bleed[engine] = val;
1522 FGControls::set_mode( int new_mode )
1528 FGControls::set_outflow_valve( double pos )
1530 outflow_valve = pos;
1531 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1535 FGControls::move_outflow_valve( double amt )
1537 outflow_valve += amt;
1538 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1542 FGControls::set_dump( bool state )
1548 FGControls::set_pack_on( int pack, bool val )
1550 if ( pack == ALL_PACKS ) {
1551 for ( int i = 0; i < MAX_PACKS; i++ ) {
1555 if ( (pack >= 0) && (pack < MAX_PACKS) ) {
1556 pack_on[pack] = val;
1562 FGControls::set_landing_lights( bool state )
1564 landing_lights = state;
1568 FGControls::set_turn_off_lights( bool state )
1570 turn_off_lights = state;
1574 FGControls::set_taxi_light( bool state )
1580 FGControls::set_logo_lights( bool state )
1582 logo_lights = state;
1586 FGControls::set_nav_lights( bool state )
1592 FGControls::set_beacon( bool state )
1598 FGControls::set_strobe( bool state )
1604 FGControls::set_panel_norm( double intensity )
1606 panel_norm = intensity;
1607 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1611 FGControls::move_panel_norm( double amt )
1614 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1618 FGControls::set_instruments_norm( double intensity )
1620 instruments_norm = intensity;
1621 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1625 FGControls::move_instruments_norm( double amt )
1627 instruments_norm += amt;
1628 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1632 FGControls::set_dome_norm( double intensity )
1634 dome_norm = intensity;
1635 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1639 FGControls::move_dome_norm( double amt )
1642 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1646 FGControls::set_master_arm( bool val )
1652 FGControls::set_station_select( int station )
1654 station_select = station;
1655 SG_CLAMP_RANGE<int>( station_select, 0, MAX_STATIONS );
1659 FGControls::set_release_ALL( bool val )
1665 FGControls::set_stick_size( int station, int size )
1667 if ( station == ALL_STATIONS ) {
1668 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1669 stick_size[i] = size;
1670 SG_CLAMP_RANGE<int>( stick_size[i], 1, 20 );
1673 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1674 stick_size[station] = size;
1675 SG_CLAMP_RANGE<int>( stick_size[station], 1, 20 );
1681 FGControls::set_release_stick( int station, bool val )
1683 if ( station == ALL_STATIONS ) {
1684 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1685 release_stick[i] = val;
1688 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1689 release_stick[station] = val;
1695 FGControls::set_release_all( int station, bool val )
1697 if ( station == ALL_STATIONS ) {
1698 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1699 release_all[i] = val;
1702 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1703 release_all[station] = val;
1709 FGControls::set_jettison_all( int station, bool val )
1711 if ( station == ALL_STATIONS ) {
1712 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1713 jettison_all[i] = val;
1716 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1717 jettison_all[station] = val;
1723 FGControls::set_vertical_adjust( double pos )
1725 vertical_adjust = pos;
1726 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1730 FGControls::move_vertical_adjust( double amt )
1732 vertical_adjust += amt;
1733 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1737 FGControls::set_fore_aft_adjust( double pos )
1739 fore_aft_adjust = pos;
1740 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1744 FGControls::move_fore_aft_adjust( double amt )
1746 fore_aft_adjust += amt;
1747 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1751 FGControls::set_ejection_seat( int which_seat, bool val )
1753 if ( which_seat == ALL_EJECTION_SEATS ) {
1754 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1758 if ( (which_seat >= 0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1759 if ( eseat_status[which_seat] == SEAT_SAFED ||
1760 eseat_status[which_seat] == SEAT_FAIL )
1762 // we can never eject if SEAT_SAFED or SEAT_FAIL
1766 eject[which_seat] = val;
1772 FGControls::set_eseat_status( int which_seat, int val )
1774 if ( which_seat == ALL_EJECTION_SEATS ) {
1775 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1776 eseat_status[i] = val;
1779 if ( (which_seat >=0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1780 eseat_status[which_seat] = val;
1786 FGControls::set_cmd_selector_valve( int val )
1788 cmd_selector_valve = val;
1793 FGControls::set_off_start_run( int pos )
1795 off_start_run = pos;
1796 SG_CLAMP_RANGE<int>( off_start_run, 0, 3 );
1800 FGControls::set_APU_fire_switch( bool val )
1802 APU_fire_switch = val;
1806 FGControls::set_autothrottle_arm( bool val )
1808 autothrottle_arm = val;
1812 FGControls::set_autothrottle_engage( bool val )
1814 autothrottle_engage = val;
1818 FGControls::set_heading_select( double heading )
1820 heading_select = heading;
1821 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1825 FGControls::move_heading_select( double amt )
1827 heading_select += amt;
1828 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1832 FGControls::set_altitude_select( double altitude )
1834 altitude_select = altitude;
1835 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1839 FGControls::move_altitude_select( double amt )
1841 altitude_select += amt;
1842 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1846 FGControls::set_bank_angle_select( double angle )
1848 bank_angle_select = angle;
1849 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1853 FGControls::move_bank_angle_select( double amt )
1855 bank_angle_select += amt;
1856 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1860 FGControls::set_vertical_speed_select( double speed )
1862 vertical_speed_select = speed;
1863 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1867 FGControls::move_vertical_speed_select( double amt )
1869 vertical_speed_select += amt;
1870 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1874 FGControls::set_speed_select( double speed )
1876 speed_select = speed;
1877 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1881 FGControls::move_speed_select( double amt )
1883 speed_select += amt;
1884 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1888 FGControls::set_mach_select( double mach )
1891 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1895 FGControls::move_mach_select( double amt )
1898 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1902 FGControls::set_vertical_mode( int mode )
1904 vertical_mode = mode;
1905 SG_CLAMP_RANGE<int>( vertical_mode, 0, 4 );
1909 FGControls::set_lateral_mode( int mode )
1911 lateral_mode = mode;
1912 SG_CLAMP_RANGE<int>( lateral_mode, 0, 4 );
1916 FGControls::set_autopilot_engage( int ap, bool val )
1918 if ( ap == ALL_AUTOPILOTS ) {
1919 for ( int i = 0; i < MAX_AUTOPILOTS; i++ ) {
1920 autopilot_engage[i] = val;
1923 if ( (ap >= 0) && (ap < MAX_AUTOPILOTS) ) {
1924 autopilot_engage[ap] = val;