]> git.mxchange.org Git - flightgear.git/blobdiff - src/Aircraft/controls.hxx
Reset: work with threaded OSG modes
[flightgear.git] / src / Aircraft / controls.hxx
index ea9c7a3bd74658bb39b5abe6d4235231819413ae..980233e5ad3ffcba3984674301e79c625fb23a1f 100644 (file)
@@ -16,7 +16,7 @@
 //
 // 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$
 
 #ifndef _CONTROLS_HXX
 #define _CONTROLS_HXX
 
-#include <simgear/props/props.hxx>
 #include <simgear/structure/subsystem_mgr.hxx>
-
-#include <Main/globals.hxx>
-
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif                                   
-
+#include <simgear/props/tiedpropertylist.hxx>
 
 // Define a structure containing the control parameters
 
@@ -42,65 +35,65 @@ class FGControls : public SGSubsystem
 public:
 
     enum {
-       ALL_ENGINES = -1,
-       MAX_ENGINES = 10
+        ALL_ENGINES = -1,
+        MAX_ENGINES = 12
     };
 
     enum {
-       ALL_WHEELS = -1,
-       MAX_WHEELS = 3
+        ALL_WHEELS = -1,
+        MAX_WHEELS = 3
     };
 
     enum {
-       ALL_TANKS = -1,
-       MAX_TANKS = 8
+        ALL_TANKS = -1,
+        MAX_TANKS = 8
     };
 
     enum {
-       ALL_BOOSTPUMPS = -1,
-       MAX_BOOSTPUMPS = 2
+        ALL_BOOSTPUMPS = -1,
+        MAX_BOOSTPUMPS = 2
     };
 
     enum {
-       ALL_HYD_SYSTEMS = -1,
-       MAX_HYD_SYSTEMS = 4
+        ALL_HYD_SYSTEMS = -1,
+        MAX_HYD_SYSTEMS = 4
     };
 
     enum {
-       ALL_PACKS = -1,
-       MAX_PACKS = 4
+        ALL_PACKS = -1,
+        MAX_PACKS = 4
     };
 
     enum {
-       ALL_LIGHTS = -1,
-       MAX_LIGHTS = 4
+        ALL_LIGHTS = -1,
+        MAX_LIGHTS = 4
     };
 
     enum {
-       ALL_STATIONS = -1,
-       MAX_STATIONS = 12
+        ALL_STATIONS = -1,
+        MAX_STATIONS = 12
     };
 
     enum {
-       ALL_AUTOPILOTS = -1,
-       MAX_AUTOPILOTS = 3
+        ALL_AUTOPILOTS = -1,
+        MAX_AUTOPILOTS = 3
     };
 
     enum {
-       ALL_EJECTION_SEATS = -1,
-       MAX_EJECTION_SEATS = 10
+        ALL_EJECTION_SEATS = -1,
+        MAX_EJECTION_SEATS = 10
     };
    
     enum {
-       SEAT_SAFED = -1,
-       SEAT_ARMED = 0,
-       SEAT_FAIL = 1
+        SEAT_SAFED = -1,
+        SEAT_ARMED = 0,
+        SEAT_FAIL = 1
     };
    
     enum { 
-       CMD_SEL_NORM = -1,
-       CMD_SEL_AFT = 0,
-       CMD_SEL_SOLO = 1
+        CMD_SEL_NORM = -1,
+        CMD_SEL_AFT = 0,
+        CMD_SEL_SOLO = 1
     };
     
 private:
@@ -161,6 +154,7 @@ private:
     double copilot_brake_right;
     double brake_parking;
     double steering;
+    bool nose_wheel_steering;
     bool gear_down;
     bool antiskid;
     bool tailhook;
@@ -258,8 +252,9 @@ private:
     int lateral_mode;
      
 
-    SGPropertyNode * auto_coordination;
-
+    SGPropertyNode_ptr auto_coordination;
+    SGPropertyNode_ptr auto_coordination_factor;
+    simgear::TiedPropertyList _tiedProperties;
 public:
 
     FGControls();
@@ -270,10 +265,11 @@ public:
     void bind ();
     void unbind ();
     void update (double dt);
-
+    virtual void reinit();
+  
     // Reset function
     void reset_all(void);
-       
+        
     // Query functions
     // controls/flight/
     inline double get_aileron() const { return aileron; }
@@ -305,7 +301,7 @@ public:
     inline bool get_cutoff(int engine) const { return cutoff[engine]; }
     inline double get_mixture(int engine) const { return mixture[engine]; }
     inline double get_prop_advance(int engine) const {
-       return prop_advance[engine];
+        return prop_advance[engine];
     }
     inline int get_magnetos(int engine) const { return magnetos[engine]; }
     inline int get_feed_tank(int engine) const { return feed_tank[engine]; }
@@ -346,6 +342,7 @@ public:
     inline double get_copilot_brake_right() const { return copilot_brake_right; }
     inline double get_brake_parking() const { return brake_parking; }
     inline double get_steering() const { return steering; }
+    inline bool get_nose_wheel_steering() const { return nose_wheel_steering; }
     inline bool get_gear_down() const { return gear_down; }
     inline bool get_antiskid() const { return antiskid; }
     inline bool get_tailhook() const { return tailhook; }
@@ -533,6 +530,7 @@ public:
     void set_brake_parking( double pos );
     void set_steering( double pos );
     void move_steering( double amt );
+    void set_nose_wheel_steering( bool nws );
     void set_gear_down( bool gear );
     void set_antiskid( bool val );
     void set_tailhook( bool val );
@@ -641,6 +639,14 @@ public:
     // controls/autoflight/autopilot[n]/
     void set_autopilot_engage( int ap, bool val );
 
+private:
+    inline void do_autocoordination() {
+      // check for autocoordination
+      if ( auto_coordination->getBoolValue() ) {
+        double factor = auto_coordination_factor->getDoubleValue();
+        if( factor > 0.0 ) set_rudder( aileron * factor );
+      }
+    }    
 };