~jtaylor/ubuntu/oneiric/flightgear/fix-749249

« back to all changes in this revision

Viewing changes to src/Instrumentation/airspeed_indicator.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-11-26 12:31:23 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20051126123123-dhs3dijy6nd257up
Tags: 0.9.8-3ubuntu1
adapt gl/glu dependencies for Xorg

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
// A higher number means more responsive.
16
16
#define RESPONSIVENESS 50.0
17
17
 
18
 
 
19
 
AirspeedIndicator::AirspeedIndicator ()
20
 
{
 
18
AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
 
19
    :
 
20
    name("airspeed-indicator"),
 
21
    num(0),
 
22
    pitot_port("/systems/pitot"),
 
23
    static_port("/systems/static")
 
24
{
 
25
    int i;
 
26
    for ( i = 0; i < node->nChildren(); ++i ) {
 
27
        SGPropertyNode *child = node->getChild(i);
 
28
        string cname = child->getName();
 
29
        string cval = child->getStringValue();
 
30
        if ( cname == "name" ) {
 
31
            name = cval;
 
32
        } else if ( cname == "number" ) {
 
33
            num = child->getIntValue();
 
34
        } else if ( cname == "pitot-port" ) {
 
35
            pitot_port = cval;
 
36
        } else if ( cname == "static-port" ) {
 
37
            static_port = cval;
 
38
        } else {
 
39
            SG_LOG( SG_INSTR, SG_WARN, "Error in aispeed-indicator config logic" );
 
40
            if ( name.length() ) {
 
41
                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
 
42
            }
 
43
        }
 
44
    }
 
45
}
 
46
 
 
47
 
 
48
AirspeedIndicator::AirspeedIndicator ( int i )
 
49
    :
 
50
    name("airspeed-indicator"),
 
51
    num(0),
 
52
    pitot_port("/systems/pitot"),
 
53
    static_port("/systems/static")
 
54
{
 
55
    num = i;
21
56
}
22
57
 
23
58
AirspeedIndicator::~AirspeedIndicator ()
27
62
void
28
63
AirspeedIndicator::init ()
29
64
{
30
 
    _serviceable_node =
31
 
        fgGetNode("/instrumentation/airspeed-indicator/serviceable",
32
 
                  true);
33
 
    _total_pressure_node =
34
 
        fgGetNode("/systems/pitot/total-pressure-inhg", true);
35
 
    _static_pressure_node =
36
 
        fgGetNode("/systems/static/pressure-inhg", true);
 
65
    string branch;
 
66
    branch = "/instrumentation/" + name;
 
67
    pitot_port += "/total-pressure-inhg";
 
68
    static_port += "/pressure-inhg";
 
69
 
 
70
    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
 
71
    _serviceable_node = node->getChild("serviceable", 0, true);
 
72
    _total_pressure_node = fgGetNode(pitot_port.c_str(), true);
 
73
    _static_pressure_node = fgGetNode(static_port.c_str(), true);
37
74
    _density_node = fgGetNode("/environment/density-slugft3", true);
38
 
    _speed_node =
39
 
        fgGetNode("/instrumentation/airspeed-indicator/indicated-speed-kt",
40
 
                  true);
 
75
    _speed_node = node->getChild("indicated-speed-kt", 0, true);
41
76
}
42
77
 
43
78
#ifndef FPSTOKTS