1
0
Fork 0

The Concorde Maintainer:

- replace hardcoded name "inst-vertical-speed-indicator" by the one from
  the instrumentation config

mf: some indentation fixes, remove redundant block
This commit is contained in:
mfranz 2008-02-07 20:41:00 +00:00
parent fa5c059295
commit 5253a271c7
2 changed files with 13 additions and 27 deletions

View file

@ -131,10 +131,12 @@ static double altitude_data[][2] = {
InstVerticalSpeedIndicator::InstVerticalSpeedIndicator ( SGPropertyNode *node ) : InstVerticalSpeedIndicator::InstVerticalSpeedIndicator ( SGPropertyNode *node ) :
_name(node->getStringValue("name", "inst-vertical-speed-indicator")),
_num(node->getIntValue("number", 0)),
_internal_pressure_inhg( SEA_LEVEL_INHG ), _internal_pressure_inhg( SEA_LEVEL_INHG ),
_internal_sea_inhg( SEA_LEVEL_INHG ), _internal_sea_inhg( SEA_LEVEL_INHG ),
_speed_ft_per_s( 0 ), _speed_ft_per_s( 0 ),
_pressure_table(new SGInterpTable), _pressure_table(new SGInterpTable),
_altitude_table(new SGInterpTable) _altitude_table(new SGInterpTable)
{ {
int i; int i;
@ -143,22 +145,6 @@ InstVerticalSpeedIndicator::InstVerticalSpeedIndicator ( SGPropertyNode *node )
for ( i = 0; altitude_data[i][0] != -1; i++) for ( i = 0; altitude_data[i][0] != -1; i++)
_altitude_table->addEntry( altitude_data[i][0], altitude_data[i][1] ); _altitude_table->addEntry( altitude_data[i][0], altitude_data[i][1] );
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 {
SG_LOG( SG_INSTR, SG_WARN, "Error in inst-vertical-speed-indicator config logic" );
if ( name.length() ) {
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
}
}
}
} }
@ -171,8 +157,10 @@ InstVerticalSpeedIndicator::~InstVerticalSpeedIndicator ()
void InstVerticalSpeedIndicator::init () void InstVerticalSpeedIndicator::init ()
{ {
SGPropertyNode *node = fgGetNode("/instrumentation", true)->getChild(_name, _num, true);
_serviceable_node = _serviceable_node =
fgGetNode("/instrumentation/inst-vertical-speed-indicator/serviceable", true); node->getNode("serviceable", true);
_freeze_node = _freeze_node =
fgGetNode("/sim/freeze/master", true); fgGetNode("/sim/freeze/master", true);
@ -189,11 +177,9 @@ void InstVerticalSpeedIndicator::init ()
_speed_up_node = _speed_up_node =
fgGetNode("/sim/speed-up", true); fgGetNode("/sim/speed-up", true);
_speed_node = _speed_node =
fgGetNode("/instrumentation/inst-vertical-speed-indicator/indicated-speed-fps", node->getNode("indicated-speed-fps", true);
true);
_speed_min_node = _speed_min_node =
fgGetNode("/instrumentation/inst-vertical-speed-indicator/indicated-speed-fpm", node->getNode("indicated-speed-fpm", true);
true);
// Initialize at ambient pressure // Initialize at ambient pressure
_internal_pressure_inhg = _pressure_node->getDoubleValue(); _internal_pressure_inhg = _pressure_node->getDoubleValue();

View file

@ -62,14 +62,14 @@ public:
private: private:
string _name;
int _num;
double _internal_pressure_inhg; double _internal_pressure_inhg;
double _internal_sea_inhg; double _internal_sea_inhg;
double _speed_ft_per_s; double _speed_ft_per_s;
string name;
int num;
SGPropertyNode_ptr _serviceable_node; SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _freeze_node; SGPropertyNode_ptr _freeze_node;
SGPropertyNode_ptr _pressure_node; SGPropertyNode_ptr _pressure_node;