1
0
Fork 0

Don't create properties for ghost tanks.

This commit is contained in:
ThorstenB 2011-04-02 11:29:40 +02:00
parent 351efd0079
commit 346b47cd5a
2 changed files with 5 additions and 4 deletions

View file

@ -27,7 +27,7 @@ var update = func {
var selected_tanks = []; var selected_tanks = [];
foreach (var t; tanks) { foreach (var t; tanks) {
var cap = t.getNode("capacity-gal_us").getValue(); var cap = t.getNode("capacity-gal_us",0).getValue();
if (cap > 0.01 and t.getNode("selected").getBoolValue()) if (cap > 0.01 and t.getNode("selected").getBoolValue())
append(selected_tanks, t); append(selected_tanks, t);
} }

View file

@ -685,7 +685,7 @@ var setWeight = func(wgt, opt) {
# Weights can have "tank" indices which set the capacity of the # Weights can have "tank" indices which set the capacity of the
# corresponding tank. This code should probably be moved to # corresponding tank. This code should probably be moved to
# something like fuel.setTankCap(tank, gals)... # something like fuel.setTankCap(tank, gals)...
if(wgt.getNode("tank") == nil) { return 0; } if(wgt.getNode("tank",0) == nil) { return 0; }
var ti = wgt.getNode("tank").getValue(); var ti = wgt.getNode("tank").getValue();
var gn = opt.getNode("gals"); var gn = opt.getNode("gals");
var gals = gn == nil ? 0 : gn.getValue(); var gals = gn == nil ? 0 : gn.getValue();
@ -886,10 +886,11 @@ var showWeightDialog = func {
var tankprop = "/consumables/fuel/tank["~i~"]"; var tankprop = "/consumables/fuel/tank["~i~"]";
var cap = t.getNode("capacity-gal_us", 1).getValue(); var cap = t.getNode("capacity-gal_us", 0);
# Hack, to ignore the "ghost" tanks created by the C++ code. # Hack, to ignore the "ghost" tanks created by the C++ code.
if(cap == nil or cap < 1) { continue; } if(cap == nil ) { continue; }
cap = cap.getValue();
var title = tcell(fuelTable, "text", i+1, 0); var title = tcell(fuelTable, "text", i+1, 0);
title.set("label", tname); title.set("label", tname);