1
0
Fork 0

simplify name/number handling

This commit is contained in:
mfranz 2006-10-26 17:46:05 +00:00
parent fc98b57b15
commit 4621db6b7c
2 changed files with 5 additions and 36 deletions

View file

@ -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 ()

View file

@ -44,7 +44,7 @@ public:
private:
string name;
int num;
unsigned int num;
string pitot_port;
string static_port;
SGPropertyNode_ptr _serviceable_node;