]> git.mxchange.org Git - flightgear.git/commitdiff
Add support for "co-pilot" toe brakes.
authorcurt <curt>
Fri, 10 Sep 2004 17:53:34 +0000 (17:53 +0000)
committercurt <curt>
Fri, 10 Sep 2004 17:53:34 +0000 (17:53 +0000)
src/Controls/controls.cxx
src/Controls/controls.hxx
src/Network/native_ctrls.cxx
src/Network/net_ctrls.hxx

index 22a69581483d527543823fc30537bbacafb352e5..a36ee4d9d3c33a62fa3d910668ab7ca7c9014dcb 100644 (file)
@@ -74,6 +74,8 @@ FGControls::FGControls() :
     dump_valve( false ),
     brake_left( 0.0 ),
     brake_right( 0.0 ),
+    copilot_brake_left( 0.0 ),
+    copilot_brake_right( 0.0 ),
     brake_parking( 0.0 ),
     steering( 0.0 ),
     gear_down( true ),
@@ -204,7 +206,9 @@ FGControls::init ()
         condition[engine] = 1.0;
     }
 
-    brake_left = brake_right = brake_parking = 0.0;
+    brake_left = brake_right
+        = copilot_brake_left = copilot_brake_right
+        = brake_parking = 0.0;
     for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
         alternate_extension[wheel] = false;
     }
@@ -433,6 +437,16 @@ FGControls::bind ()
         &FGControls::set_brake_right);
   fgSetArchivable("/controls/gear/brake-right");
 
+  fgTie("/controls/gear/copilot-brake-left", this,
+       &FGControls::get_copilot_brake_left, 
+        &FGControls::set_copilot_brake_left);
+  fgSetArchivable("/controls/gear/copilot-brake-left");
+
+  fgTie("/controls/gear/copilot-brake-right", this,
+       &FGControls::get_copilot_brake_right, 
+        &FGControls::set_copilot_brake_right);
+  fgSetArchivable("/controls/gear/copilot-brake-right");
+
   fgTie("/controls/gear/brake-parking", this,
        &FGControls::get_brake_parking, 
         &FGControls::set_brake_parking);
@@ -1628,6 +1642,20 @@ FGControls::move_brake_right( double amt )
     CLAMP( &brake_right, 0.0, 1.0 );
 }
 
+void
+FGControls::set_copilot_brake_left( double pos )
+{
+    copilot_brake_left = pos;
+    CLAMP(&brake_left, 0.0, 1.0);
+}
+
+void
+FGControls::set_copilot_brake_right( double pos )
+{
+    copilot_brake_right = pos;
+    CLAMP(&brake_right, 0.0, 1.0);
+}
+
 void
 FGControls::set_brake_parking( double pos )
 {
index 209e26d79f6e28d16b0d0630bb049eaf4b3bd82d..82f9b92336cbfbed7c80fa3097e8012c2e27348e 100644 (file)
@@ -156,6 +156,8 @@ private:
     // controls/gear/
     double brake_left;
     double brake_right;
+    double copilot_brake_left;
+    double copilot_brake_right;
     double brake_parking;
     double steering;
     bool gear_down;
@@ -336,6 +338,8 @@ public:
     // controls/gear/
     inline double get_brake_left() const { return brake_left; }
     inline double get_brake_right() const { return brake_right; }
+    inline double get_copilot_brake_left() const { return copilot_brake_left; }
+    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_gear_down() const { return gear_down; }
@@ -519,6 +523,8 @@ public:
     void move_brake_left( double amt );
     void set_brake_right( double pos );
     void move_brake_right( double amt );
+    void set_copilot_brake_left( double pos );
+    void set_copilot_brake_right( double pos );
     void set_brake_parking( double pos );
     void set_steering( double pos );
     void move_steering( double amt );
index c8453e1f89f77ee312da1ce07c72c1ca2b13bfae..4d2051a35caaf387312fb4bce5a2935fee71e6f9 100644 (file)
@@ -187,6 +187,10 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
     node = fgGetNode("/controls/gear", true);
     net->brake_left = node->getChild("brake-left")->getDoubleValue();
     net->brake_right = node->getChild("brake-right")->getDoubleValue();
+    net->copilot_brake_left
+        = node->getChild("copilot-brake-left")->getDoubleValue();
+    net->copilot_brake_right
+        = node->getChild("copilot-brake-right")->getDoubleValue();
     net->brake_parking = node->getChild("brake-parking")->getDoubleValue();
 
     net->gear_handle = fgGetBool( "controls/gear/gear-down" );
@@ -262,6 +266,8 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
         net->num_tanks = htonl(net->num_tanks);
         htond(net->brake_left);
         htond(net->brake_right);
+        htond(net->copilot_brake_left);
+        htond(net->copilot_brake_right);
         htond(net->brake_parking);
         net->gear_handle = htonl(net->gear_handle);
         net->master_avionics = htonl(net->master_avionics);
@@ -321,6 +327,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
         }
         htond(net->brake_left);
         htond(net->brake_right);
+        htond(net->copilot_brake_left);
+        htond(net->copilot_brake_right);
         htond(net->brake_parking);
         net->gear_handle = htonl(net->gear_handle);
         net->master_avionics = htonl(net->master_avionics);
@@ -390,6 +398,10 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
     if ( node != NULL ) {
         node->getChild( "brake-left" )->setDoubleValue( net->brake_left );
         node->getChild( "brake-right" )->setDoubleValue( net->brake_right );
+        node->getChild( "copilot-brake-left" )
+            ->setDoubleValue( net->copilot_brake_left );
+        node->getChild( "copilot-brake-right" )
+            ->setDoubleValue( net->copilot_brake_right );
         node->getChild( "brake-parking" )->setDoubleValue( net->brake_parking );
     }
 
index cc6ae5af9e3b4d0490c138e28f6ba224c8c1b112..1508b7ac56500d30781ddba989f165f2ca793e41 100644 (file)
@@ -16,7 +16,7 @@
 # error This library requires C++
 #endif                                   
 
-const int FG_NET_CTRLS_VERSION = 22;
+const int FG_NET_CTRLS_VERSION = 23;
 
 
 // Define a structure containing the control parameters
@@ -71,6 +71,8 @@ public:
     // Brake controls
     double brake_left;
     double brake_right;
+    double copilot_brake_left;
+    double copilot_brake_right;
     double brake_parking;
     
     // Landing Gear