]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/native_ctrls.cxx
Add generic input support
[flightgear.git] / src / Network / native_ctrls.cxx
index ace029444b4b5f3ce154fb3a07e06f99cf9193e0..4d2051a35caaf387312fb4bce5a2935fee71e6f9 100644 (file)
@@ -125,9 +125,20 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
         node = fgGetNode("/controls/engines/engine", i );
         starter = fgGetNode("/systems/electrical/outputs/starter", i );
         fuelpump = fgGetNode("/systems/electrical/outputs/fuel-pump", i );
+
+        tempnode = node->getChild("master-bat");
+        if ( tempnode != NULL ) {
+            net->master_bat[i] = tempnode->getBoolValue();
+        }
+        tempnode = node->getChild("master-alt");
+        if ( tempnode != NULL ) {
+            net->master_alt[i] = tempnode->getBoolValue();
+        }
+
         net->throttle[i] = node->getDoubleValue( "throttle", 0.0 );
        net->mixture[i] = node->getDoubleValue( "mixture", 0.0 );
        net->prop_advance[i] = node->getDoubleValue( "propeller-pitch", 0.0 );
+       net->condition[i] = node->getDoubleValue( "condition", 0.0 );
        net->magnetos[i] = node->getIntValue( "magnetos", 0 );
        if ( i == 0 ) {
          // cout << "Magnetos -> " << node->getIntValue( "magnetos", 0 );
@@ -176,17 +187,14 @@ 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();
 
-    node = fgGetNode("/controls/switches", true);
-    tempnode = node->getChild("master-bat");
-    if ( tempnode != NULL ) {
-        net->master_bat = tempnode->getBoolValue();
-    }
-    tempnode = node->getChild("master-alt");
-    if ( tempnode != NULL ) {
-        net->master_alt = tempnode->getBoolValue();
-    }
+    net->gear_handle = fgGetBool( "controls/gear/gear-down" );
+
     tempnode = node->getChild("master-avionics");
     if ( tempnode != NULL ) {
         net->master_avionics = tempnode->getBoolValue();
@@ -207,6 +215,9 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
     // the user is switching views.
     net->hground = cur_fdm_state->get_ground_elev_ft() * SG_FEET_TO_METER;
     net->magvar = fgGetDouble("/environment/magnetic-variation-deg");
+
+    net->icing = fgGetDouble("/hazards/icing/wing");
+
     net->speedup = fgGetInt("/sim/speed-up");
     net->freeze = 0;
     if ( honor_freezes ) {
@@ -232,12 +243,15 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
         net->flaps_power = htonl(net->flaps_power);
         net->flap_motor_ok = htonl(net->flap_motor_ok);
         for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
+            net->master_bat[i] = htonl(net->master_bat[i]);
+            net->master_alt[i] = htonl(net->master_alt[i]);
             net->magnetos[i] = htonl(net->magnetos[i]);
             net->starter_power[i] = htonl(net->starter_power[i]);
             htond(net->throttle[i]);
             htond(net->mixture[i]);
             net->fuel_pump_power[i] = htonl(net->fuel_pump_power[i]);
             htond(net->prop_advance[i]);
+            htond(net->condition[i]);
            net->engine_ok[i] = htonl(net->engine_ok[i]);
            net->mag_left_ok[i] = htonl(net->mag_left_ok[i]);
            net->mag_right_ok[i] = htonl(net->mag_right_ok[i]);
@@ -252,10 +266,10 @@ 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_bat = htonl(net->master_bat);
-        net->master_alt = htonl(net->master_alt);
         net->master_avionics = htonl(net->master_avionics);
         htond(net->wind_speed_kt);
         htond(net->wind_dir_deg);
@@ -264,6 +278,7 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
         htond(net->press_inhg);
        htond(net->hground);
         htond(net->magvar);
+        net->icing = htonl(net->icing);
         net->speedup = htonl(net->speedup);
         net->freeze = htonl(net->freeze);
     }
@@ -290,12 +305,15 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
         net->flap_motor_ok = htonl(net->flap_motor_ok);
         net->num_engines = htonl(net->num_engines);
         for ( i = 0; i < net->num_engines; ++i ) {
+            net->master_bat[i] = htonl(net->master_bat[i]);
+            net->master_alt[i] = htonl(net->master_alt[i]);
             net->magnetos[i] = htonl(net->magnetos[i]);
             net->starter_power[i] = htonl(net->starter_power[i]);
             htond(net->throttle[i]);
             htond(net->mixture[i]);
             net->fuel_pump_power[i] = htonl(net->fuel_pump_power[i]);
             htond(net->prop_advance[i]);
+            htond(net->condition[i]);
            net->engine_ok[i] = htonl(net->engine_ok[i]);
            net->mag_left_ok[i] = htonl(net->mag_left_ok[i]);
            net->mag_right_ok[i] = htonl(net->mag_right_ok[i]);
@@ -309,10 +327,10 @@ 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_bat = htonl(net->master_bat);
-        net->master_alt = htonl(net->master_alt);
         net->master_avionics = htonl(net->master_avionics);
         htond(net->wind_speed_kt);
         htond(net->wind_dir_deg);
@@ -321,6 +339,7 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
         htond(net->press_inhg);
         htond(net->hground);
         htond(net->magvar);
+        net->icing = htonl(net->icing);
         net->speedup = htonl(net->speedup);
         net->freeze = htonl(net->freeze);
     }
@@ -348,6 +367,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
         node->getChild( "mixture" )->setDoubleValue( net->mixture[i] );
         node->getChild( "propeller-pitch" )
             ->setDoubleValue( net->prop_advance[i] );
+        node->getChild( "condition" )
+            ->setDoubleValue( net->condition[i] );
         node->getChild( "magnetos" )->setDoubleValue( net->magnetos[i] );
 
        // Faults
@@ -377,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 );
     }
 
@@ -401,6 +426,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
 
     // ground elevation ???
 
+    fgSetDouble("/hazards/icing/wing", net->icing);
+
     fgSetInt( "/sim/speed-up", net->speedup );
 
     if ( honor_freezes ) {