]> git.mxchange.org Git - flightgear.git/commitdiff
Added a fuel selector switch. I understand that this won't handle all
authorcurt <curt>
Fri, 5 Jul 2002 14:46:38 +0000 (14:46 +0000)
committercurt <curt>
Fri, 5 Jul 2002 14:46:38 +0000 (14:46 +0000)
situations for every kind of airplane.  But at the moment we have nothing
implimented and this will cover the simpler cases until someone has a
chance to impliment a fuller solution.

src/Controls/controls.cxx
src/Controls/controls.hxx

index 8c2ab506689e0d9e7e71642a4c92c7d2c75f4b7e..9b598467bd5f8a25b478e4032eecb5f13d8e30ae 100644 (file)
@@ -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");
 }
 
index e865a59753b0580c6a3e9e289fc724baa19f0521..2165df04c3fea8a8e7fe1e37042fe5028184527c 100644 (file)
@@ -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 );