]> git.mxchange.org Git - flightgear.git/commitdiff
Return a positive shortage when there is still fuel in the tank;
authordavid <david>
Sat, 19 Jan 2002 18:25:52 +0000 (18:25 +0000)
committerdavid <david>
Sat, 19 Jan 2002 18:25:52 +0000 (18:25 +0000)
otherwise, the logic in FGEngine::ConsumeFuel breaks down and the
engine is starved when *any* feed tank is empty, rather than when all
feed tanks are empty.

src/FDM/JSBSim/FGTank.cpp

index 55b7d09ecdc54804551063a2389f16e61715ca82..9f77de5a1f82e4c8d6bc1ea3a3ba0f1c168c1ab9 100644 (file)
@@ -95,19 +95,17 @@ FGTank::~FGTank()
 
 double FGTank::Reduce(double used)
 {
-  double shortage;
+  double shortage = Contents - used;
 
-  if (used < Contents) {
+  if (shortage >= 0) {
     Contents -= used;
     PctFull = 100.0*Contents/Capacity;
-    return 0.0;
   } else {
-    shortage = Contents - used;
     Contents = 0.0;
     PctFull = 0.0;
     Selected = false;
-    return shortage;
   }
+  return shortage;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%