]> git.mxchange.org Git - flightgear.git/blobdiff - src/Systems/vacuum.cxx
Remove debug console output in FGApproachController
[flightgear.git] / src / Systems / vacuum.cxx
index cab464404fdd8dc89cea069683d978dc3472b802..9bf84e284d48fb5a4f992cb8122fb61426c1162c 100644 (file)
@@ -8,6 +8,9 @@
 #endif
 
 #include "vacuum.hxx"
+
+#include <cstring>
+
 #include <Main/fg_props.hxx>
 
 
@@ -17,20 +20,10 @@ VacuumSystem::VacuumSystem ( SGPropertyNode *node )
     _num(node->getIntValue("number", 0)),
     _scale(node->getDoubleValue("scale", 1.0))
 {
-    _rpms.clear();
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
+    for ( int i = 0; i < node->nChildren(); ++i ) {
         SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "rpm" ) {
-            _rpms.push_back(cval);
-        } else {
-            SG_LOG( SG_SYSTEMS, SG_WARN, "Error in vacuum config logic" );
-            if ( _name.length() ) {
-                SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << _name );
-            }
-        }
+        if (!strcmp(child->getName(), "rpm"))
+            _rpms.push_back(child->getStringValue());
     }
 }
 
@@ -42,7 +35,7 @@ void
 VacuumSystem::init()
 {
     unsigned int i;
-    string branch;
+    std::string branch;
     branch = "/systems/" + _name;
 
     SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
@@ -53,6 +46,14 @@ VacuumSystem::init()
     }
     _pressure_node = fgGetNode("/environment/pressure-inhg", true);
     _suction_node = node->getChild("suction-inhg", 0, true);
+
+    reinit();
+}
+
+void
+VacuumSystem::reinit()
+{
+    _suction_node->setDoubleValue(0.0);
 }
 
 void
@@ -76,14 +77,14 @@ VacuumSystem::update (double dt)
     if (!_serviceable_node->getBoolValue()) {
         suction = 0.0;
     } else {
-       // select the source with the max rpm
+        // select the source with the max rpm
         double rpm = 0.0;
-       for ( i = 0; i < _rpm_nodes.size(); i++ ) {
-         double tmp = _rpm_nodes[i]->getDoubleValue() * _scale;
-         if ( tmp > rpm ) {
-           rpm = tmp;
-         }
-       }
+        for ( i = 0; i < _rpm_nodes.size(); i++ ) {
+          double tmp = _rpm_nodes[i]->getDoubleValue() * _scale;
+          if ( tmp > rpm ) {
+            rpm = tmp;
+          }
+        }
         double pressure = _pressure_node->getDoubleValue();
         // This magic formula yields about 4 inhg at 700 rpm
         suction = pressure * rpm / (rpm + 4875.0);