From 346b47cd5a93044b994ec3a45b077819b1fe9c45 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 2 Apr 2011 11:29:40 +0200 Subject: [PATCH] Don't create properties for ghost tanks. --- Nasal/fuel.nas | 2 +- Nasal/gui.nas | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Nasal/fuel.nas b/Nasal/fuel.nas index 35643fec0..e4a26ae07 100644 --- a/Nasal/fuel.nas +++ b/Nasal/fuel.nas @@ -27,7 +27,7 @@ var update = func { var selected_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()) append(selected_tanks, t); } diff --git a/Nasal/gui.nas b/Nasal/gui.nas index 2b92aeb07..cc18c00c3 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -685,7 +685,7 @@ var setWeight = func(wgt, opt) { # Weights can have "tank" indices which set the capacity of the # corresponding tank. This code should probably be moved to # 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 gn = opt.getNode("gals"); var gals = gn == nil ? 0 : gn.getValue(); @@ -886,10 +886,11 @@ var showWeightDialog = func { 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. - if(cap == nil or cap < 1) { continue; } + if(cap == nil ) { continue; } + cap = cap.getValue(); var title = tcell(fuelTable, "text", i+1, 0); title.set("label", tname);