]> git.mxchange.org Git - flightgear.git/commitdiff
simplify name/number handling
authormfranz <mfranz>
Thu, 26 Oct 2006 17:46:05 +0000 (17:46 +0000)
committermfranz <mfranz>
Thu, 26 Oct 2006 17:46:05 +0000 (17:46 +0000)
src/Instrumentation/airspeed_indicator.cxx
src/Instrumentation/airspeed_indicator.hxx

index db34f3fce6f70739b3ab29cd504f0307a6167649..5d5c6c39e801b02479e32e11cdfa933cf0eb54b7 100644 (file)
 
 AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
     :
-    name("airspeed-indicator"),
-    num(0),
-    pitot_port("/systems/pitot"),
-    static_port("/systems/static")
+    name(node->getStringValue("name", "airspeed-indicator")),
+    num(node->getIntValue("number", 0)),
+    pitot_port(node->getStringValue("pitot-port", "/systems/pitot")),
+    static_port(node->getStringValue("static-port", "/systems/static"))
 {
-    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 if ( cname == "pitot-port" ) {
-            pitot_port = cval;
-        } else if ( cname == "static-port" ) {
-            static_port = cval;
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in aispeed-indicator config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-
-AirspeedIndicator::AirspeedIndicator ( int i )
-    :
-    name("airspeed-indicator"),
-    num(0),
-    pitot_port("/systems/pitot"),
-    static_port("/systems/static")
-{
-    num = i;
 }
 
 AirspeedIndicator::~AirspeedIndicator ()
index 6f10b9ddb01a5fab3154e6e08891cd8171419759..5bab3aa7a7db0136f47361020c4b24b682d29941 100644 (file)
@@ -44,7 +44,7 @@ public:
 private:
 
     string name;
-    int num;
+    unsigned int num;
     string pitot_port;
     string static_port;
     SGPropertyNode_ptr _serviceable_node;