]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/native_fdm.cxx
Expose the "play-audio-command" through the props/telnet interface.
[flightgear.git] / src / Network / native_fdm.cxx
index 939c93dda248435272b916c2c9820d87f7601809..88ac0ffa9cd9236f0a8c49da0d06017d8d064b05 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started September 2001.
 //
-// Copyright (C) 2001  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -120,7 +120,7 @@ bool FGNativeFDM::open() {
 
 
 void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
-    int i;
+    unsigned int i;
 
     // Version sanity checking
     net->version = FG_NET_FDM_VERSION;
@@ -173,7 +173,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         net->fuel_flow[i] = node->getDoubleValue( "fuel-flow-gph" );
         net->egt[i] = node->getDoubleValue( "egt-degf" );
         // cout << "egt = " << aero->EGT << endl;
+        net->cht[i] = node->getDoubleValue( "cht-degf" );
         net->mp_osi[i] = node->getDoubleValue( "mp-osi" );
+        net->tit[i] = node->getDoubleValue( "tit" );
         net->oil_temp[i] = node->getDoubleValue( "oil-temperature-degf" );
         net->oil_px[i] = node->getDoubleValue( "oil-pressure-psi" );
     }
@@ -189,7 +191,7 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     net->num_wheels = FGNetFDM::FG_MAX_WHEELS;
     for (i = 0; i < net->num_wheels; ++i ) {
         SGPropertyNode *node = fgGetNode("/gear/gear", i, true);
-        net->wow[i] = node->getDoubleValue("wow");
+        net->wow[i] = node->getIntValue("wow");
         net->gear_pos[i] = node->getDoubleValue("position-norm");
         net->gear_steer[i] = node->getDoubleValue("steering-norm");
         net->gear_compression[i] = node->getDoubleValue("compression-norm");
@@ -205,7 +207,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     net->elevator = node->getDoubleValue( "elevator-pos-norm" );
     net->elevator_trim_tab
         = node->getDoubleValue( "elevator-trim-tab-pos-norm" );
-    net->flaps = node->getDoubleValue( "flap-pos-norm" );
+    // FIXME: CLO 10/28/04 - This really should be separated out into 2 values
+    net->left_flap = node->getDoubleValue( "flap-pos-norm" );
+    net->right_flap = node->getDoubleValue( "flap-pos-norm" );
     net->left_aileron = node->getDoubleValue( "left-aileron-pos-norm" );
     net->right_aileron = node->getDoubleValue( "right-aileron-pos-norm" );
     net->rudder = node->getDoubleValue( "rudder-pos-norm" );
@@ -251,7 +255,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
             htonf(net->rpm[i]);
             htonf(net->fuel_flow[i]);
             htonf(net->egt[i]);
+            htonf(net->cht[i]);
             htonf(net->mp_osi[i]);
+            htonf(net->tit[i]);
             htonf(net->oil_temp[i]);
             htonf(net->oil_px[i]);
         }
@@ -276,7 +282,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
 
         htonf(net->elevator);
         htonf(net->elevator_trim_tab);
-        htonf(net->flaps);
+        htonf(net->left_flap);
+        htonf(net->right_flap);
         htonf(net->left_aileron);
         htonf(net->right_aileron);
         htonf(net->rudder);
@@ -288,7 +295,7 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
 
 
 void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
-    int i;
+    unsigned int i;
 
     if ( net_byte_order ) {
         // Convert to the net buffer from network format
@@ -329,7 +336,9 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
             htonf(net->rpm[i]);
             htonf(net->fuel_flow[i]);
             htonf(net->egt[i]);
+            htonf(net->cht[i]);
             htonf(net->mp_osi[i]);
+            htonf(net->tit[i]);
             htonf(net->oil_temp[i]);
             htonf(net->oil_px[i]);
         }
@@ -347,13 +356,14 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
             htonf(net->gear_compression[i]);
         }
 
-        net->cur_time = ntohl(net->cur_time);
+        net->cur_time = htonl(net->cur_time);
         net->warp = ntohl(net->warp);
         htonf(net->visibility);
 
         htonf(net->elevator);
         htonf(net->elevator_trim_tab);
-        htonf(net->flaps);
+        htonf(net->left_flap);
+        htonf(net->right_flap);
         htonf(net->left_aileron);
         htonf(net->right_aileron);
         htonf(net->rudder);
@@ -373,8 +383,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
        if ( net->agl > -9000 ) {
            cur_fdm_state->_set_Altitude_AGL( net->agl * SG_METER_TO_FEET );
        } else {
-           double agl_m
-             = net->altitude - globals->get_scenery()->get_cur_elev();
+           double agl_m = net->altitude
+              - cur_fdm_state->get_Runway_altitude_m();
            cur_fdm_state->_set_Altitude_AGL( agl_m * SG_METER_TO_FEET );
        }
         cur_fdm_state->_set_Euler_Angles( net->phi,
@@ -424,7 +434,9 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
            node->setDoubleValue( "rpm", net->rpm[i] );
            node->setDoubleValue( "fuel-flow-gph", net->fuel_flow[i] );
            node->setDoubleValue( "egt-degf", net->egt[i] );
+           node->setDoubleValue( "cht-degf", net->cht[i] );
            node->setDoubleValue( "mp-osi", net->mp_osi[i] );
+           node->setDoubleValue( "tit", net->tit[i] );
            node->setDoubleValue( "oil-temperature-degf", net->oil_temp[i] );
            node->setDoubleValue( "oil-pressure-psi", net->oil_px[i] );         
        }
@@ -457,7 +469,10 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         node->setDoubleValue("elevator-pos-norm", net->elevator);
         node->setDoubleValue("elevator-trim-tab-pos-norm",
                              net->elevator_trim_tab);
-        node->setDoubleValue("flap-pos-norm", net->flaps);
+       // FIXME: CLO 10/28/04 - This really should be separated out
+       // into 2 values
+        node->setDoubleValue("flap-pos-norm", net->left_flap);
+        node->setDoubleValue("flap-pos-norm", net->right_flap);
         node->setDoubleValue("left-aileron-pos-norm", net->left_aileron);
         node->setDoubleValue("right-aileron-pos-norm", net->right_aileron);
         node->setDoubleValue("rudder-pos-norm", net->rudder);