1
0
Fork 0

Avoid div-by-zero and NaN-property error

required for non-engine aircraft (UFO, gliders).
This commit is contained in:
ThorstenB 2011-01-12 20:13:57 +01:00
parent 98277733d5
commit b85838b770

View file

@ -152,7 +152,10 @@ var update_loop = func {
setprop("/consumables/fuel/total-fuel-gals", gals);
setprop("/consumables/fuel/total-fuel-lbs", lbs);
setprop("/consumables/fuel/total-fuel-norm", gals / cap);
if (cap == 0)
setprop("/consumables/fuel/total-fuel-norm", 0);
else
setprop("/consumables/fuel/total-fuel-norm", gals / cap);
foreach (var e; engines)
e.getNode("out-of-fuel", 1).setBoolValue(out_of_fuel);