]> git.mxchange.org Git - flightgear.git/blobdiff - src/Controls/controls.hxx
Sync with latest JSBSim CVS
[flightgear.git] / src / Controls / controls.hxx
index c90bcb304a144c33f3ef38ea2779db29459f5290..225a05a357b742cfc140d9c8ea5bfe5cedfe75c8 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <simgear/misc/props.hxx>
 
-#include <Sound/soundmgr.hxx>
 #include <Main/fgfs.hxx>
 #include <Main/globals.hxx>
 
@@ -65,7 +64,9 @@ private:
     double mixture[MAX_ENGINES];
     double prop_advance[MAX_ENGINES];
     double brake[MAX_WHEELS];
+    int magnetos[MAX_ENGINES];
     bool throttle_idle;
+    bool starter[MAX_ENGINES];
     bool gear_down;
 
     SGPropertyNode * auto_coordination;
@@ -74,7 +75,12 @@ private:
        if ( *x < min ) { *x = min; }
        if ( *x > max ) { *x = max; }
     }
-               
+
+    inline void CLAMP(int *i, int min, int max ) {
+       if ( *i < min ) { *i = min; }
+       if ( *i > max ) { *i = max; }
+    }
+    
 public:
 
     FGControls();
@@ -101,6 +107,8 @@ public:
        return prop_advance[engine];
     }
     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 bool get_gear_down() const { return gear_down; }
 
     // Update functions
@@ -149,16 +157,10 @@ public:
        CLAMP( &rudder, -1.0, 1.0 );
     }
     inline void set_flaps( double pos ) {
-       if ( flaps != pos ) {
-           globals->get_soundmgr()->play_once( "flaps" );
-       }
        flaps = pos;
        CLAMP( &flaps, 0.0, 1.0 );
     }
     inline void move_flaps( double amt ) {
-       if ( fabs(amt) > 0.0 ) {
-           globals->get_soundmgr()->play_once( "flaps" );
-       }
        flaps += amt;
        CLAMP( &flaps, 0.0, 1.0 );
     }
@@ -240,6 +242,43 @@ public:
            }
        }
     }
+    inline void set_magnetos( int engine, int pos ) {
+       if ( engine == ALL_ENGINES ) {
+           for ( int i = 0; i < MAX_ENGINES; i++ ) {
+               magnetos[i] = pos;
+               CLAMP( &magnetos[i], 0, 3 );
+           }
+       } else {
+           if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
+               magnetos[engine] = pos;
+               CLAMP( &magnetos[engine], 0, 3 );
+           }
+       }
+    }
+    inline void move_magnetos( int engine, int amt ) {
+       if ( engine == ALL_ENGINES ) {
+           for ( int i = 0; i < MAX_ENGINES; i++ ) {
+               magnetos[i] += amt;
+               CLAMP( &magnetos[i], 0, 3 );
+           }
+       } else {
+           if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
+               magnetos[engine] += amt;
+               CLAMP( &magnetos[engine], 0, 3 );
+           }
+       }
+    }
+    inline void set_starter( int engine, bool flag ) {
+       if ( engine == ALL_ENGINES ) {
+           for ( int i = 0; i < MAX_ENGINES; i++ ) {
+               starter[i] = flag;
+           }
+       } else {
+           if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
+               starter[engine] = flag;
+           }
+       }
+    }
     inline void set_brake( int wheel, double pos ) {
        if ( wheel == ALL_WHEELS ) {
            for ( int i = 0; i < MAX_WHEELS; i++ ) {