From 47772b9853cad2580dcc4dc665092fd660966ae5 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 19 Jan 2002 18:25:52 +0000 Subject: [PATCH] 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. --- src/FDM/JSBSim/FGTank.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- 2.39.5