]> git.mxchange.org Git - flightgear.git/blobdiff - src/Controls/controls.hxx
- adjusted for no-value constructor for FGPanel
[flightgear.git] / src / Controls / controls.hxx
index e12c4362e971b9962bf3965810330f39c1132dad..ba2a92d5bae1d8dbd2f1cdd5f514e6b3ea9e00a8 100644 (file)
@@ -24,6 +24,9 @@
 #ifndef _CONTROLS_HXX
 #define _CONTROLS_HXX
 
+#include <simgear/misc/props.hxx>
+
+#include <Main/fgfs.hxx>
 #include <Main/globals.hxx>
 
 #ifndef __cplusplus                                                          
@@ -33,7 +36,8 @@
 
 // Define a structure containing the control parameters
 
-class FGControls {
+class FGControls : public FGSubsystem
+{
 
 public:
 
@@ -62,6 +66,8 @@ private:
     double brake[MAX_WHEELS];
     bool throttle_idle;
 
+    SGPropertyNode * auto_coordination;
+
     inline void CLAMP(double *x, double min, double max ) {
        if ( *x < min ) { *x = min; }
        if ( *x > max ) { *x = max; }
@@ -72,6 +78,12 @@ public:
     FGControls();
     ~FGControls();
 
+    // Implementation of FGSubsystem.
+    void init ();
+    void bind ();
+    void unbind ();
+    void update ();
+
     // Reset function
     void reset_all(void);
        
@@ -94,8 +106,7 @@ public:
        CLAMP( &aileron, -1.0, 1.0 );
                        
        // check for autocoordination
-       if ( globals->get_options()->get_auto_coordination() == 
-            FGOptions::FG_AUTO_COORD_ENABLED ) 
+       if ( auto_coordination->getBoolValue() ) 
        {
            set_rudder( aileron / 2.0 );
        }
@@ -105,8 +116,7 @@ public:
        CLAMP( &aileron, -1.0, 1.0 );
                        
        // check for autocoordination
-       if ( globals->get_options()->get_auto_coordination() == 
-            FGOptions::FG_AUTO_COORD_ENABLED ) 
+       if ( auto_coordination->getBoolValue() ) 
        {
            set_rudder( aileron / 2.0 );
        }
@@ -136,10 +146,16 @@ 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 );
     }