]> git.mxchange.org Git - flightgear.git/blobdiff - src/Aircraft/controls.cxx
Added two missing files from JSBSim.org that were missing in the last sync.
[flightgear.git] / src / Aircraft / controls.cxx
index 3594e7664844c7116be041d728409e8e5facbf19..5eeadc1a1ddae27daae9eab6756cbb2a0b736ad1 100644 (file)
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
 
 #include <simgear/compiler.h>
 #include <simgear/debug/logstream.hxx>
@@ -78,6 +81,7 @@ FGControls::FGControls() :
     copilot_brake_right( 0.0 ),
     brake_parking( 0.0 ),
     steering( 0.0 ),
+    nose_wheel_steering( true ),
     gear_down( true ),
     antiskid( true ),
     tailhook( false ),
@@ -157,6 +161,7 @@ void FGControls::reset_all()
     set_fuel_selector( ALL_TANKS, true );
     dump_valve = false;
     steering =  0.0;
+    nose_wheel_steering = true;
     gear_down = true;
     tailhook = false;
     launchbar = false;
@@ -198,9 +203,12 @@ FGControls::init ()
        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;
@@ -208,6 +216,21 @@ FGControls::init ()
         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
@@ -342,6 +365,13 @@ FGControls::bind ()
     fgTie(name, this, index,
         &FGControls::get_magnetos, &FGControls::set_magnetos);
     fgSetArchivable(name);
+    
+   snprintf(name, MAX_NAME_LEN,
+       "/controls/engines/engine[%d]/feed_tank", index);
+    fgTie(name, this, index,
+        &FGControls::get_feed_tank, &FGControls::set_feed_tank);
+    fgSetArchivable(name);
+
 
     snprintf(name, MAX_NAME_LEN, "/controls/engines/engine[%d]/WEP", index);
     fgTie(name, this, index,
@@ -460,6 +490,11 @@ FGControls::bind ()
        &FGControls::get_steering, &FGControls::set_steering);
   fgSetArchivable("/controls/gear/steering");
 
+  fgTie("/controls/gear/nose-wheel-steering", this,
+       &FGControls::get_nose_wheel_steering,
+        &FGControls::set_nose_wheel_steering);
+  fgSetArchivable("/controls/gear/nose-wheel-steering");
+
   fgTie("/controls/gear/gear-down", this,
        &FGControls::get_gear_down, &FGControls::set_gear_down);
   fgSetArchivable("/controls/gear/gear-down");
@@ -835,6 +870,9 @@ void FGControls::unbind ()
     snprintf(name, MAX_NAME_LEN,
              "/controls/engines/engine[%d]/throttle", index);
     fgUntie(name);
+    snprintf(name, MAX_NAME_LEN,
+             "/controls/engines/engine[%d]/feed_tank", index);
+    fgUntie(name);
     snprintf(name, MAX_NAME_LEN,
              "/controls/engines/engine[%d]/starter", index);
     fgUntie(name);
@@ -904,7 +942,8 @@ void FGControls::unbind ()
   fgUntie("/controls/gear/brake-right");
   fgUntie("/controls/gear/brake-parking");
   fgUntie("/controls/gear/steering");
-  fgUntie("/controls/gear/gear_down");
+  fgUntie("/controls/gear/nose-wheel-steering");
+  fgUntie("/controls/gear/gear-down");
   fgUntie("/controls/gear/antiskid");
   fgUntie("/controls/gear/tailhook");
   fgUntie("/controls/gear/launchbar");
@@ -1330,6 +1369,23 @@ FGControls::set_cutoff( int engine, bool val )
     }
 }
 
+void
+FGControls::set_feed_tank( int engine, int tank )
+{ 
+    if ( engine == ALL_ENGINES ) {
+       for ( int i = 0; i < MAX_ENGINES; i++ ) {
+           feed_tank[i] = tank;
+           CLAMP( &feed_tank[i], -1, 4 );
+       }
+    } else {
+       if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
+           feed_tank[engine] = tank;
+           CLAMP( &feed_tank[engine], -1, 4 );
+       }
+    } 
+ //   feed_tank[engine] = engine;
+}
+
 
 void
 FGControls::set_mixture( int engine, double pos )
@@ -1682,6 +1738,12 @@ FGControls::set_steering( double angle )
     CLAMP(&steering, -80.0, 80.0);
 }
 
+void
+FGControls::set_nose_wheel_steering( bool nws )
+{
+    nose_wheel_steering = nws;
+}
+
 void
 FGControls::move_steering( double angle )
 {