From: david Date: Sat, 19 Jan 2002 18:25:52 +0000 (+0000) Subject: Return a positive shortage when there is still fuel in the tank; X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=47772b9853cad2580dcc4dc665092fd660966ae5;p=flightgear.git Return a positive shortage when there is still fuel in the tank; 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. --- diff --git a/src/FDM/JSBSim/FGTank.cpp b/src/FDM/JSBSim/FGTank.cpp index 55b7d09ec..9f77de5a1 100644 --- a/src/FDM/JSBSim/FGTank.cpp +++ b/src/FDM/JSBSim/FGTank.cpp @@ -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; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%