diff --git a/src/FDM/JSBSim/input_output/net_fdm.hxx b/src/FDM/JSBSim/input_output/net_fdm.hxx index 600f9cf09..11c869e2b 100644 --- a/src/FDM/JSBSim/input_output/net_fdm.hxx +++ b/src/FDM/JSBSim/input_output/net_fdm.hxx @@ -90,7 +90,7 @@ public: float oil_px[FG_MAX_ENGINES]; // Oil pressure psi // Consumables - uint32_t num_tanks; // Max number of fuel tanks + uint32_t num_tanks; // Max number of fuel tanks float fuel_quantity[FG_MAX_TANKS]; // Gear status diff --git a/src/Network/native_fdm.cxx b/src/Network/native_fdm.cxx index 95908a56a..fde31f4b9 100644 --- a/src/Network/native_fdm.cxx +++ b/src/Network/native_fdm.cxx @@ -191,6 +191,11 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) { for ( i = 0; i < net->num_tanks; ++i ) { SGPropertyNode *node = fgGetNode("/consumables/fuel/tank", i, true); net->fuel_quantity[i] = node->getDoubleValue("level-gal_us"); + net->tank_selected[i] = node->getBoolValue("selected"); + net->capacity_m3[i] = node->getDoubleValue("capacity-m3"); + net->unusable_m3[i] = node->getDoubleValue("unusable-m3"); + net->density_kgpm3[i] = node->getDoubleValue("density-kgpm3"); + net->level_m3[i] = node->getDoubleValue("level-m3"); } // Gear and flaps @@ -272,6 +277,11 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) { for ( i = 0; i < net->num_tanks; ++i ) { htonf(net->fuel_quantity[i]); + htonl(net->tank_selected[i]); + htond(net->capacity_m3[i]); + htond(net->unusable_m3[i]); + htond(net->density_kgpm3[i]); + htond(net->level_m3[i]); } net->num_tanks = htonl(net->num_tanks); @@ -355,6 +365,11 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) { net->num_tanks = htonl(net->num_tanks); for ( i = 0; i < net->num_tanks; ++i ) { htonf(net->fuel_quantity[i]); + htonl(net->tank_selected[i]); + htond(net->capacity_m3[i]); + htond(net->unusable_m3[i]); + htond(net->density_kgpm3[i]); + htond(net->level_m3[i]); } net->num_wheels = htonl(net->num_wheels); @@ -455,8 +470,13 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) { for (i = 0; i < net->num_tanks; ++i ) { SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true); - node->setDoubleValue("level-gal_us", net->fuel_quantity[i] ); - } + node->setDoubleValue("level-gal_us", net->fuel_quantity[i]); + node->setBoolValue("selected", net->tank_selected[i] > 0); + node->setDoubleValue("capacity-m3", net->capacity_m3[i]); + node->setDoubleValue("unusable-m3", net->unusable_m3[i]); + node->setDoubleValue("density-kgpm3", net->density_kgpm3[i]); + node->setDoubleValue("level-m3", net->level_m3[i]); + } for (i = 0; i < net->num_wheels; ++i ) { SGPropertyNode * node = fgGetNode("/gear/gear", i, true); diff --git a/src/Network/net_fdm.hxx b/src/Network/net_fdm.hxx index 353a1812b..0e316446f 100644 --- a/src/Network/net_fdm.hxx +++ b/src/Network/net_fdm.hxx @@ -90,8 +90,14 @@ public: float oil_px[FG_MAX_ENGINES]; // Oil pressure psi // Consumables - uint32_t num_tanks; // Max number of fuel tanks - float fuel_quantity[FG_MAX_TANKS]; + uint32_t num_tanks; // Max number of fuel tanks + float fuel_quantity[FG_MAX_TANKS]; // used by GPSsmooth and possibly others + uint32_t tank_selected[FG_MAX_TANKS]; // selected, capacity, usable, density and level required for multiple-pc setups to work + double capacity_m3[FG_MAX_TANKS]; + double unusable_m3[FG_MAX_TANKS]; + double density_kgpm3[FG_MAX_TANKS]; + double level_m3[FG_MAX_TANKS]; + // Gear status uint32_t num_wheels;