From 4621db6b7cdf6630526a1cc58b1a98dd72fc4aa4 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 26 Oct 2006 17:46:05 +0000 Subject: [PATCH] simplify name/number handling --- src/Instrumentation/airspeed_indicator.cxx | 39 +++------------------- src/Instrumentation/airspeed_indicator.hxx | 2 +- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/src/Instrumentation/airspeed_indicator.cxx b/src/Instrumentation/airspeed_indicator.cxx index db34f3fce..5d5c6c39e 100644 --- a/src/Instrumentation/airspeed_indicator.cxx +++ b/src/Instrumentation/airspeed_indicator.cxx @@ -17,42 +17,11 @@ 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 () diff --git a/src/Instrumentation/airspeed_indicator.hxx b/src/Instrumentation/airspeed_indicator.hxx index 6f10b9ddb..5bab3aa7a 100644 --- a/src/Instrumentation/airspeed_indicator.hxx +++ b/src/Instrumentation/airspeed_indicator.hxx @@ -44,7 +44,7 @@ public: private: string name; - int num; + unsigned int num; string pitot_port; string static_port; SGPropertyNode_ptr _serviceable_node;