X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fairspeed_indicator.cxx;h=0196ddbaef9bd20b3d420f1c0f78ae0f868b9af0;hb=bb2b03c7e392e107aeaf7dbc4eecc59064b28512;hp=db34f3fce6f70739b3ab29cd504f0307a6167649;hpb=2c72f131639d4c2c2f1de7cff65f7ceab95f61c4;p=flightgear.git diff --git a/src/Instrumentation/airspeed_indicator.cxx b/src/Instrumentation/airspeed_indicator.cxx index db34f3fce..0196ddbae 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)), + _total_pressure(node->getStringValue("total-pressure", "/systems/pitot/total-pressure-inhg")), + _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")) { - 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 () @@ -63,14 +32,12 @@ void AirspeedIndicator::init () { string branch; - branch = "/instrumentation/" + name; - pitot_port += "/total-pressure-inhg"; - static_port += "/pressure-inhg"; + branch = "/instrumentation/" + _name; - SGPropertyNode *node = fgGetNode(branch.c_str(), num, true ); + SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true ); _serviceable_node = node->getChild("serviceable", 0, true); - _total_pressure_node = fgGetNode(pitot_port.c_str(), true); - _static_pressure_node = fgGetNode(static_port.c_str(), true); + _total_pressure_node = fgGetNode(_total_pressure.c_str(), true); + _static_pressure_node = fgGetNode(_static_pressure.c_str(), true); _density_node = fgGetNode("/environment/density-slugft3", true); _speed_node = node->getChild("indicated-speed-kt", 0, true); }