simplify name/number handling
This commit is contained in:
parent
fc98b57b15
commit
4621db6b7c
2 changed files with 5 additions and 36 deletions
src/Instrumentation
|
@ -17,42 +17,11 @@
|
||||||
|
|
||||||
AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
|
AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
|
||||||
:
|
:
|
||||||
name("airspeed-indicator"),
|
name(node->getStringValue("name", "airspeed-indicator")),
|
||||||
num(0),
|
num(node->getIntValue("number", 0)),
|
||||||
pitot_port("/systems/pitot"),
|
pitot_port(node->getStringValue("pitot-port", "/systems/pitot")),
|
||||||
static_port("/systems/static")
|
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 ()
|
AirspeedIndicator::~AirspeedIndicator ()
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
int num;
|
unsigned int num;
|
||||||
string pitot_port;
|
string pitot_port;
|
||||||
string static_port;
|
string static_port;
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
|
|
Loading…
Add table
Reference in a new issue