diff --git a/src/Controls/controls.cxx b/src/Controls/controls.cxx index 8c2ab5066..9b598467b 100644 --- a/src/Controls/controls.cxx +++ b/src/Controls/controls.cxx @@ -62,6 +62,7 @@ FGControls::FGControls() : flaps( 0.0 ), parking_brake( 0.0 ), throttle_idle( true ), + fuel_selector( FUEL_BOTH ), gear_down( false ) { } @@ -69,16 +70,17 @@ FGControls::FGControls() : void FGControls::reset_all() { - set_aileron(0.0); - set_aileron_trim(0.0); - set_elevator(0.0); - set_elevator_trim(0.0); - set_rudder(0.0); - set_rudder_trim(0.0); - set_throttle(FGControls::ALL_ENGINES, 0.0); - set_starter(FGControls::ALL_ENGINES, false); - set_magnetos(FGControls::ALL_ENGINES, 0); + set_aileron( 0.0 ); + set_aileron_trim( 0.0 ); + set_elevator( 0.0 ); + set_elevator_trim( 0.0 ); + set_rudder( 0.0 ); + set_rudder_trim( 0.0 ); + set_throttle( ALL_ENGINES, 0.0 ); + set_starter( ALL_ENGINES, false ); + set_magnetos( ALL_ENGINES, 0 ); throttle_idle = true; + fuel_selector = FUEL_BOTH; gear_down = true; } @@ -165,6 +167,9 @@ FGControls::bind () &FGControls::get_brake, &FGControls::set_brake); fgSetArchivable(name); } + fgTie("/controls/fuel-selector", this, + &FGControls::get_fuel_selector, &FGControls::set_fuel_selector); + fgSetArchivable("/controls/gear-down"); fgTie("/controls/gear-down", this, &FGControls::get_gear_down, &FGControls::set_gear_down); fgSetArchivable("/controls/gear-down"); @@ -201,6 +206,7 @@ FGControls::unbind () sprintf(name, "/controls/brakes[%d]", index); fgUntie(name); } + fgUntie("/controls/fuel-selector"); fgUntie("/controls/gear-down"); } diff --git a/src/Controls/controls.hxx b/src/Controls/controls.hxx index e865a5975..2165df04c 100644 --- a/src/Controls/controls.hxx +++ b/src/Controls/controls.hxx @@ -41,18 +41,23 @@ class FGControls : public FGSubsystem public: - enum - { + enum { ALL_ENGINES = -1, MAX_ENGINES = 10 }; - enum - { + enum { ALL_WHEELS = -1, MAX_WHEELS = 3 }; + enum { + FUEL_OFF = 0, + FUEL_LEFT = 1, + FUEL_RIGHT = 2, + FUEL_BOTH = 3 + }; + private: double aileron; @@ -70,6 +75,7 @@ private: int magnetos[MAX_ENGINES]; bool throttle_idle; bool starter[MAX_ENGINES]; + int fuel_selector; bool gear_down; SGPropertyNode * auto_coordination; @@ -105,6 +111,7 @@ public: inline double get_brake(int wheel) const { return brake[wheel]; } inline int get_magnetos(int engine) const { return magnetos[engine]; } inline bool get_starter(int engine) const { return starter[engine]; } + inline int get_fuel_selector() const { return fuel_selector; } inline bool get_gear_down() const { return gear_down; } // Update functions @@ -131,6 +138,7 @@ public: void set_magnetos( int engine, int pos ); void move_magnetos( int engine, int amt ); void set_starter( int engine, bool flag ); + void set_fuel_selector( int pos ) { fuel_selector = pos; } void set_parking_brake( double pos ); void set_brake( int wheel, double pos ); void move_brake( int wheel, double amt );