]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/dclgps.cxx
NavDisplay: ignore case when matching symbol types in rules.
[flightgear.git] / src / Instrumentation / dclgps.cxx
index 92aa558cf181102fa211a5a7038063f1d04e531d..42157d7a1836ffcde8db0f510c4b7c97977b24eb 100644 (file)
@@ -152,12 +152,6 @@ DCLGPS::DCLGPS(RenderArea2D* instrument) {
        _instrument = instrument;
        _nFields = 1;
        _maxFields = 2;
-       
-       // Units - lets default to US units - FG can set them to other units from config during startup if desired.
-       _altUnits = GPS_ALT_UNITS_FT;
-       _baroUnits = GPS_PRES_UNITS_IN;
-       _velUnits = GPS_VEL_UNITS_KT;
-       _distUnits = GPS_DIST_UNITS_NM;
 
        _lon_node = fgGetNode("/instrumentation/gps/indicated-longitude-deg", true);
        _lat_node = fgGetNode("/instrumentation/gps/indicated-latitude-deg", true);
@@ -245,22 +239,18 @@ void DCLGPS::init() {
 }
 
 void DCLGPS::bind() {
-       fgTie("/instrumentation/gps/waypoint-alert", this, &DCLGPS::GetWaypointAlert);
-       fgTie("/instrumentation/gps/leg-mode", this, &DCLGPS::GetLegMode);
-       fgTie("/instrumentation/gps/obs-mode", this, &DCLGPS::GetOBSMode);
-       fgTie("/instrumentation/gps/approach-arm", this, &DCLGPS::GetApproachArm);
-       fgTie("/instrumentation/gps/approach-active", this, &DCLGPS::GetApproachActive);
-       fgTie("/instrumentation/gps/cdi-deflection", this, &DCLGPS::GetCDIDeflection);
-       fgTie("/instrumentation/gps/to-flag", this, &DCLGPS::GetToFlag);
+       _tiedProperties.setRoot(fgGetNode("/instrumentation/gps", true));
+       _tiedProperties.Tie("waypoint-alert",  this, &DCLGPS::GetWaypointAlert);
+       _tiedProperties.Tie("leg-mode",        this, &DCLGPS::GetLegMode);
+       _tiedProperties.Tie("obs-mode",        this, &DCLGPS::GetOBSMode);
+       _tiedProperties.Tie("approach-arm",    this, &DCLGPS::GetApproachArm);
+       _tiedProperties.Tie("approach-active", this, &DCLGPS::GetApproachActive);
+       _tiedProperties.Tie("cdi-deflection",  this, &DCLGPS::GetCDIDeflection);
+       _tiedProperties.Tie("to-flag",         this, &DCLGPS::GetToFlag);
 }
 
 void DCLGPS::unbind() {
-       fgUntie("/instrumentation/gps/waypoint-alert");
-       fgUntie("/instrumentation/gps/leg-mode");
-       fgUntie("/instrumentation/gps/obs-mode");
-       fgUntie("/instrumentation/gps/approach-arm");
-       fgUntie("/instrumentation/gps/approach-active");
-       fgUntie("/instrumentation/gps/cdi-deflection");
+       _tiedProperties.Untie();
 }
 
 void DCLGPS::update(double dt) {
@@ -660,7 +650,7 @@ string DCLGPS::ExpandSIAPIdent(const string& ident) {
        Col 107-111     MSA center fix.  We can ignore this.
 */
 void DCLGPS::LoadApproachData() {
-       FGNPIAP* iap;
+       FGNPIAP* iap = NULL;
        GPSWaypoint* wp;
        GPSFlightPlan* fp;
        const GPSWaypoint* cwp;
@@ -814,7 +804,7 @@ void DCLGPS::LoadApproachData() {
                                                                                        w.lat = rwy->begin().getLatitudeRad();
                                                                                        w.lon = rwy->begin().getLongitudeRad();
                                                                                } catch(const sg_exception&) {
-                                                                                       SG_LOG(SG_GENERAL, SG_WARN, "Unable to find runway " << w.id.substr(2, 2) << " at airport " << iap->_aptIdent);
+                                                                                       SG_LOG(SG_INSTR, SG_WARN, "Unable to find runway " << w.id.substr(2, 2) << " at airport " << iap->_aptIdent);
                                                                                        //cout << "Unable to find runway " << w.id.substr(2, 2) << " at airport " << iap->_aptIdent << " ( w.id = " << w.id << ", rwystr = " << rwystr << " )\n";
                                                                                        wp_error = true;
                                                                                }
@@ -1098,16 +1088,6 @@ void DCLGPS::DrawChar(char c, int field, int px, int py, bool bold) {
 void DCLGPS::DrawText(const string& s, int field, int px, int py, bool bold) {
 }
 
-void DCLGPS::SetBaroUnits(int n, bool wrap) {
-       if(n < 1) {
-               _baroUnits = (GPSPressureUnits)(wrap ? 3 : 1);
-       } else if(n > 3) {
-               _baroUnits = (GPSPressureUnits)(wrap ? 1 : 3);
-       } else {
-               _baroUnits = (GPSPressureUnits)n;
-       }
-}
-
 void DCLGPS::CreateDefaultFlightPlans() {}
 
 // Get the time to the active waypoint in seconds.