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:
parent
e2cf6d90d2
commit
449c7bf7ef
1 changed files with 10 additions and 4 deletions
|
@ -35,11 +35,17 @@ fuelUpdate = func {
|
|||
|
||||
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 = [];
|
||||
foreach(t; AllTanks) {
|
||||
if(t.getNode("selected", 1).getBoolValue()) {
|
||||
append(selectedTanks, t);
|
||||
cap = t.getNode("capacity-gal_us", 1).getValue();
|
||||
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) {
|
||||
initDoubleProp(t, "level-gal_us", 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
|
||||
|
||||
if(t.getNode("selected") == nil) {
|
||||
|
|
Loading…
Reference in a new issue