+ "Version mismatch with raw controls packet format." );
+ SG_LOG( SG_IO, SG_ALERT,
+ "FlightGear needs version = " << FG_NET_CTRLS_VERSION
+ << " but is receiving version = " << net->version );
+ }
+ node = fgGetNode("/controls/flight", true);
+ node->setDoubleValue( "aileron", net->aileron );
+ node->setDoubleValue( "elevator", net->elevator );
+ node->setDoubleValue( "rudder", net->rudder );
+ node->setDoubleValue( "aileron-trim", net->aileron_trim );
+ node->setDoubleValue( "elevator-trim", net->elevator_trim );
+ node->setDoubleValue( "rudder-trim", net->rudder_trim );
+ node->setDoubleValue( "flaps", net->flaps );
+ node->setDoubleValue( "speedbrake", net->speedbrake ); //JWW
+ // or
+ node->setDoubleValue( "spoilers", net->spoilers ); //JWW
+// cout << "NET->Spoilers: " << net->spoilers << endl;
+ fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power > 0 );
+ node->setBoolValue( "flaps-serviceable", net->flap_motor_ok > 0 );
+
+ for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
+ // Controls
+ node = fgGetNode("/controls/engines/engine", i);
+ node->getChild( "throttle" )->setDoubleValue( net->throttle[i] );
+ 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] );
+ node->getChild( "starter" )->setDoubleValue( net->starter_power[i] );
+ node->getChild( "feed_tank" )->setIntValue( net->feed_tank_to[i] );
+ node->getChild( "reverser" )->setBoolValue( net->reverse[i] > 0 );
+ // Faults
+ SGPropertyNode *faults = node->getNode( "faults", true );
+ faults->setBoolValue( "serviceable", net->engine_ok[i] > 0 );
+ faults->setBoolValue( "left-magneto-serviceable",
+ net->mag_left_ok[i] > 0 );
+ faults->setBoolValue( "right-magneto-serviceable",
+ net->mag_right_ok[i] > 0);
+ faults->setBoolValue( "spark-plugs-serviceable",
+ net->spark_plugs_ok[i] > 0);
+ faults->setIntValue( "oil-pressure-status", net->oil_press_status[i] );
+ faults->setBoolValue( "fuel-pump-serviceable", net->fuel_pump_ok[i] > 0);
+ }
+
+ fgSetBool( "/systems/electrical/outputs/fuel-pump",
+ net->fuel_pump_power[0] > 0);
+
+ for ( i = 0; i < FGNetCtrls::FG_MAX_TANKS; ++i ) {
+ node = fgGetNode( "/controls/fuel/tank", i );
+ node->getChild( "fuel_selector" )
+ ->setBoolValue( net->fuel_selector[i] > 0 );
+// node->getChild( "to_tank" )->xfer_tank( i, net->xfer_to[i] );
+ }
+ node = fgGetNode( "/controls/gear" );
+ 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 );
+ }
+
+ node = fgGetNode( "/controls/gear", true );
+ node->setBoolValue( "gear-down", net->gear_handle > 0 );
+// node->setDoubleValue( "brake-parking", net->brake_parking );
+// node->setDoubleValue( net->brake_left );
+// node->setDoubleValue( net->brake_right );
+
+ node = fgGetNode( "/controls/switches", true );
+ node->setBoolValue( "master-bat", net->master_bat > 0 );
+ node->setBoolValue( "master-alt", net->master_alt > 0);
+ node->setBoolValue( "master-avionics", net->master_avionics > 0);
+
+ node = fgGetNode( "/environment", true );
+ node->setDoubleValue( "wind-speed-kt", net->wind_speed_kt );
+ node->setDoubleValue( "wind-from-heading-deg", net->wind_dir_deg );
+ node->setDoubleValue( "turbulence/magnitude-norm", net->turbulence_norm );
+ node->setDoubleValue( "magnetic-variation-deg", net->magvar );
+
+ node->setDoubleValue( "/environment/temperature-degc",
+ net->temp_c );
+ node->setDoubleValue( "/environment/pressure-sea-level-inhg",
+ net->press_inhg );
+
+ // ground elevation ???
+
+ fgSetDouble("/hazards/icing/wing", net->icing);
+
+ node = fgGetNode( "/radios", true );
+ node->setDoubleValue( "comm/frequencies/selected-mhz[0]", net->comm_1 );
+ node->setDoubleValue( "nav/frequencies/selected-mhz[0]", net->nav_1 );
+ node->setDoubleValue( "nav[1]/frequencies/selected-mhz[0]", net->nav_2 );
+
+ fgSetDouble( "/sim/speed-up", net->speedup );
+
+ if ( honor_freezes ) {
+ node = fgGetNode( "/sim/freeze", true );
+ node->setBoolValue( "master", (net->freeze & 0x01) > 0 );
+ node->setBoolValue( "position", (net->freeze & 0x02) > 0 );
+ node->setBoolValue( "fuel", (net->freeze & 0x04) > 0 );