1
0
Fork 0

Oops. A last minute change broke piston engines. The "phantom" fuel

tanks created by the C++ code look empty, and were causing the fuel
code to detect out of fuel conditions.  Since there is no way to tell
a "FDM" tank from a "C++" tank, I just filter them by capacity.  Very
ugly hack, we need to fix the code to report only the tanks created
by the aircraft/FDM configuration.
This commit is contained in:
andy 2004-03-27 18:26:55 +00:00
parent e2cf6d90d2
commit 449c7bf7ef

View file

@ -35,11 +35,17 @@ fuelUpdate = func {
AllTanks = props.globals.getNode("consumables/fuel").getChildren("tank"); AllTanks = props.globals.getNode("consumables/fuel").getChildren("tank");
# Build a list of selected tanks # Build a list of selected tanks. Note the filtering for
# "zero-capacity" tanks. The FlightGear code likes to define
# zombie tanks that have no meaning to the FDM, so we have to take
# measures to ignore them here.
selectedTanks = []; selectedTanks = [];
foreach(t; AllTanks) { foreach(t; AllTanks) {
if(t.getNode("selected", 1).getBoolValue()) { cap = t.getNode("capacity-gal_us", 1).getValue();
append(selectedTanks, t); if(cap != nil and cap > 0.01) {
if(t.getNode("selected", 1).getBoolValue()) {
append(selectedTanks, t);
}
} }
} }
@ -94,7 +100,7 @@ initialize = func {
foreach(t; AllTanks) { foreach(t; AllTanks) {
initDoubleProp(t, "level-gal_us", 0); initDoubleProp(t, "level-gal_us", 0);
initDoubleProp(t, "level-lbs", 0); initDoubleProp(t, "level-lbs", 0);
initDoubleProp(t, "capacity-gal_us", 1); # Not zero (div/zero issue) initDoubleProp(t, "capacity-gal_us", 0.01); # Not zero (div/zero issue)
initDoubleProp(t, "density-ppg", 6.0); # gasoline initDoubleProp(t, "density-ppg", 6.0); # gasoline
if(t.getNode("selected") == nil) { if(t.getNode("selected") == nil) {