]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/opengc.cxx
Fix a couple of 64-bit warnings identified by GCC.
[flightgear.git] / src / Network / opengc.cxx
index 6cdb5a4f55566fa6344739eef2a8f46774a4f398..687df7a04c6e2ed15c0fc1301e636021ecb99561 100644 (file)
@@ -38,7 +38,7 @@
 #include <vector>
 
 #include "opengc.hxx"
-#include <FDM/flight.hxx>
+#include <FDM/flightProperties.hxx>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 
@@ -101,9 +101,11 @@ FGOpenGC::FGOpenGC() :
        p_alphadot(fgGetNode("/fdm/jsbsim/aero/alphadot-rad_sec[0]", true)),
        p_betadot(fgGetNode("/fdm/jsbsim/aero/betadot-rad_sec[0]", true))
 {
+  fdm = new FlightProperties;
 }
 
 FGOpenGC::~FGOpenGC() {
+  delete fdm;
 }
 
 // open hailing frequencies
@@ -127,7 +129,7 @@ bool FGOpenGC::open() {
 }
 
 //static void collect_data( const FGInterface *fdm, ogcFGData *data ) {
-void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {       
+void FGOpenGC::collect_data(ogcFGData *data ) {        
                                                                                        
     data->version_id = OGC_VERSION;
     
@@ -144,16 +146,16 @@ void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
    
     data->vvi = p_vvi->getDoubleValue();
     data->mach = p_mach->getDoubleValue();
-    data->groundspeed = cur_fdm_state->get_V_ground_speed();
-    data->v_keas = cur_fdm_state->get_V_equiv_kts();
+    data->groundspeed = fdm->get_V_ground_speed();
+    data->v_keas = fdm->get_V_equiv_kts();
     data->v_kcas = vel_kcas->getDoubleValue();
  
 
-    data->phi_dot = cur_fdm_state->get_Phi_dot();
-    data->theta_dot = cur_fdm_state->get_Theta_dot();
-    data->psi_dot = cur_fdm_state->get_Psi_dot();
+    data->phi_dot = fdm->get_Phi_dot();
+    data->theta_dot = fdm->get_Theta_dot();
+    data->psi_dot = fdm->get_Psi_dot();
 
-    data->alpha = cur_fdm_state->get_Alpha();
+    data->alpha = fdm->get_Alpha();
     data->beta = p_yaw->getDoubleValue();
     data->alpha_dot = p_alphadot->getDoubleValue();
     data->beta_dot = p_yaw_rate->getDoubleValue();
@@ -272,9 +274,9 @@ void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
                data->x_feed_valve[2] = x_feed2_node->getBoolValue(); 
                data->x_feed_valve[3] = x_feed3_node->getBoolValue(); 
                **********/                     
-    data->total_temperature = cur_fdm_state->get_Total_temperature();
-    data->total_pressure = cur_fdm_state->get_Total_pressure();
-    data->dynamic_pressure = cur_fdm_state->get_Dynamic_pressure();
+    data->total_temperature = fdm->get_Total_temperature();
+    data->total_pressure = fdm->get_Total_pressure();
+    data->dynamic_pressure = fdm->get_Dynamic_pressure();
     
     data->static_pressure = press_node->getDoubleValue();
     data->static_temperature = temp_node->getDoubleValue();
@@ -283,7 +285,7 @@ void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
     data->sea_level_pressure = fgGetDouble("/environment/sea-level-pressure-inhg");
 }
 
-static void distribute_data( const ogcFGData *data, FGInterface *chunk ) {
+static void distribute_data( const ogcFGData *data ) {
     // just a place holder until the CDU is developed
        
 }
@@ -294,7 +296,7 @@ bool FGOpenGC::process() {
     int length = sizeof(buf);
 
     if ( get_direction() == SG_IO_OUT ) {
-        collect_data( cur_fdm_state, &buf );
+        collect_data( &buf );
        //collect_data( &buf );
        if ( ! io->write( (char *)(& buf), length ) ) {
            SG_LOG( SG_IO, SG_ALERT, "Error writing data." );
@@ -304,12 +306,12 @@ bool FGOpenGC::process() {
        if ( io->get_type() == sgFileType ) {
            if ( io->read( (char *)(& buf), length ) == length ) {
                SG_LOG( SG_IO, SG_DEBUG, "Success reading data." );
-               distribute_data( &buf, cur_fdm_state );
+               distribute_data( &buf );
            }
        } else {
            while ( io->read( (char *)(& buf), length ) == length ) {
                SG_LOG( SG_IO, SG_DEBUG, "Success reading data." );
-               distribute_data( &buf, cur_fdm_state );
+               distribute_data( &buf );
            }
        }
     }