]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGTank.cpp
builddir -> srcdir so builds can be done outside the master source directory.
[flightgear.git] / src / FDM / JSBSim / FGTank.cpp
index ea118069547dfd3046e5f94f5b4d7b8b6894d993..12fdf2ae004a0423e6f4269539c33bed410699dc 100644 (file)
@@ -42,22 +42,29 @@ INCLUDES
 *******************************************************************************/
 
 
-FGTank::FGTank(ifstream& acfile)
+FGTank::FGTank(FGConfigFile* AC_cfg)
 {
   string type;
 
-  acfile >> type;                              // Type = 0: fuel, 1: oxidizer
+  *AC_cfg >> type;                              // Type = 0: fuel, 1: oxidizer
+
   if (type == "FUEL") Type = ttFUEL;
   else if (type == "OXIDIZER") Type = ttOXIDIZER;
   else Type = ttUNKNOWN;
-  acfile >> X;                                 // inches
-  acfile >> Y;                                 // "
-  acfile >> Z;                                 // "
-  acfile >> Radius;                            // "
-  acfile >> Capacity;                          // pounds (amount it can hold)
-  acfile >> Contents;                          // pounds  (amount it is holding)
+  *AC_cfg >> X;                                 // inches
+  *AC_cfg >> Y;                                 // "
+  *AC_cfg >> Z;                                 // "
+  *AC_cfg >> Radius;                            // "
+  *AC_cfg >> Capacity;                          // pounds (amount it can hold)
+  *AC_cfg >> Contents;                          // pounds  (amount it is holding)
   Selected = true;
-  PctFull = 100.0*Contents/Capacity;           // percent full; 0 to 100.0
+
+  if (Capacity != 0) {
+    PctFull = 100.0*Contents/Capacity;            // percent full; 0 to 100.0
+  } else {
+    Contents = 0;
+    PctFull  = 0;
+  }     
 }