-static void raw2global( const FGRawFDM *raw, FGInterface *global ) {
- if ( raw->version == FG_RAW_FDM_VERSION ) {
- // cout << "pos = " << raw->longitude << " " << raw->latitude << endl;
- // cout << "sea level rad = " << cur_fdm_state->get_Sea_level_radius() << endl;
- cur_fdm_state->_updateGeodeticPosition( raw->latitude,
- raw->longitude,
- raw->altitude
- * SG_METER_TO_FEET );
- cur_fdm_state->_set_Euler_Angles( raw->phi,
- raw->theta,
- raw->psi );
- cur_fdm_state->_set_V_calibrated_kts( raw->vcas );
- cur_fdm_state->_set_Climb_Rate( raw->climb_rate );
+static void net2global( FGNetFDM *net, FGInterface *global ) {
+ static long int last_warp = 0;
+
+ // Convert to the net buffer from network format
+ net->version = ntohl(net->version);
+ htond(net->longitude);
+ htond(net->latitude);
+ htond(net->altitude);
+ htond(net->phi);
+ htond(net->theta);
+ htond(net->psi);
+ htond(net->vcas);
+ htond(net->climb_rate);
+ net->cur_time = ntohl(net->cur_time);
+ net->warp = ntohl(net->warp);
+ htond(net->visibility);
+
+ if ( net->version == FG_NET_FDM_VERSION ) {
+ // cout << "pos = " << net->longitude << " " << net->latitude << endl;
+ // cout << "sea level rad = " << cur_fdm_state->get_Sea_level_radius() << endl;
+ cur_fdm_state->_updateGeodeticPosition( net->latitude,
+ net->longitude,
+ net->altitude
+ * SG_METER_TO_FEET );
+ cur_fdm_state->_set_Euler_Angles( net->phi,
+ net->theta,
+ net->psi );
+ cur_fdm_state->_set_V_calibrated_kts( net->vcas );
+ cur_fdm_state->_set_Climb_Rate( net->climb_rate );
+
+ if ( net->cur_time ) {
+ fgSetLong("/sim/time/cur-time-override", net->cur_time);
+ }
+
+ globals->set_warp( net->warp );
+ if ( net->warp != last_warp ) {
+ fgUpdateSkyAndLightingParams();
+ }
+ last_warp = net->warp;
+
+ fgSetDouble( "/environment/visibility-m", net->visibility );