]> git.mxchange.org Git - flightgear.git/blobdiff - src/Systems/pitot.cxx
toggle fullscreen: also adapt GUI plane when resizing
[flightgear.git] / src / Systems / pitot.cxx
index 136533f1b3f1371f26b998c63a29a532929f5b92..b367283b2ed3f4db66c6e2a280e197e620c7429a 100644 (file)
@@ -3,6 +3,10 @@
 //
 // This file is in the Public Domain and comes with no warranty.
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <simgear/constants.h>
 
 #include <Main/fg_props.hxx>
 
 PitotSystem::PitotSystem ( SGPropertyNode *node )
     :
-    num(0),
-    name("pitot")
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-PitotSystem::PitotSystem ( int i )
+    _name(node->getStringValue("name", "pitot")),
+    _num(node->getIntValue("number", 0))
 {
-    num = i;
-    name = "pitot";
 }
 
 PitotSystem::~PitotSystem ()
@@ -48,9 +30,9 @@ void
 PitotSystem::init ()
 {
     string branch;
-    branch = "/systems/" + name;
+    branch = "/systems/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
     _pressure_node = fgGetNode("/environment/pressure-inhg", true);
     _density_node = fgGetNode("/environment/density-slugft3", true);