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

index b624e6405c8455b859c9bf401dcc4fd0a9bc3658..acf11412d4cb50df3d1b769e080df5c96920a31e 100644 (file)
 
 
 GSDI::GSDI(SGPropertyNode *node) :
-       _name("gsdi"),
-       _num(0)
-{
-       for (int i = 0; i < node->nChildren(); ++i) {
-               SGPropertyNode *child = node->getChild(i);
-               string name = child->getName();
-
-               if (name == "name") {
-                       _name = child->getStringValue();
-               } else if (name == "number") {
-                       _num = child->getIntValue();
-               } else {
-                       SG_LOG(SG_INSTR, SG_WARN, "Error in gsdi config logic");
-                       if (_name.length())
-                               SG_LOG(SG_INSTR, SG_WARN, "Section = " << _name);
-               }
-       }
-}
-
-
-GSDI::GSDI()
+       _name(node->getStringValue("name", "gsdi")),
+       _num(node->getIntValue("number", 0))
 {
 }
 
index b63566bc9f749377f973534001b8949e9e49ed6b..2fc8e2966441ba895bf4ff563cc32771be293a18 100644 (file)
@@ -45,7 +45,6 @@ class GSDI : public SGSubsystem
 {
 public:
        GSDI(SGPropertyNode *node);
-       GSDI();
        virtual ~GSDI();
 
        virtual void init();
@@ -53,7 +52,7 @@ public:
 
 private:
        string _name;
-       int _num;
+       unsigned int _num;
 
        SGPropertyNode_ptr _serviceableN;
        SGPropertyNode_ptr _headingN;