]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runways.cxx
Add a *really* crude model of ITT, Oil Temp, and Oil Pressure. This
[flightgear.git] / src / Airports / runways.cxx
index ed958ea2e213d4bc18899aa7acdc898bb2e8e9b5..d9c5d2a3c5093c9f525b5aaca8f8621552844dfc 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started August 2000.
 //
-// Copyright (C) 2000  Curtis L. Olson  - curt@flightgear.org
+// Copyright (C) 2000  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -54,9 +54,12 @@ operator >> ( istream& in, FGRunway& a )
         in >> a.id >> a.rwy_no >> a.lat >> a.lon >> a.heading
            >> a.length >> a.width >> a.surface_flags >> a.end1_flags
            >> tmp >> tmp >> a.end2_flags >> tmp >> tmp;
+    } else if ( a.type == "T" ) {
+        // in >> a.id >> a.rwy_no >> a.lat >> a.lon >> a.heading
+        //    >> a.length >> a.width >> a.surface_flags;
+        in >> skipeol;
     } else {
-        in >> a.id >> a.rwy_no >> a.lat >> a.lon >> a.heading
-           >> a.length >> a.width >> a.surface_flags;
+        in >> skipeol;
     }
 
     return in;
@@ -79,7 +82,9 @@ FGRunwayList::FGRunwayList( const string& file ) {
     FGRunway rwy;
     while ( in ) {
         in >> rwy;
-        runways.insert(pair<const string, FGRunway>(rwy.id, rwy));
+        if(rwy.type == "R") {
+            runways.insert(pair<const string, FGRunway>(rwy.id, rwy));
+        }
     }
 }
 
@@ -95,8 +100,8 @@ static string GetReverseRunwayNo(string rwyno) {
     if (( tmp == "L" || tmp == "R" || tmp == "C" ) || (rwyno.size() == 1)) {
        tmp = rwyno;
        rwyno = "0" + tmp;
-        SG_LOG( SG_GENERAL, SG_INFO, "Standardising rwy number from " << tmp
-                                     << " to " << rwyno );
+        SG_LOG( SG_GENERAL, SG_INFO,
+                "Standardising rwy number from " << tmp << " to " << rwyno );
     }
     
     char buf[4];
@@ -116,12 +121,15 @@ static string GetReverseRunwayNo(string rwyno) {
        } else if (rwyno.substr(2,1) == "C") {
            buf[2] = 'C';
            buf[3] = '\0';
+       } else if (rwyno.substr(2,1) == "T") {
+           buf[2] = 'T';
+           buf[3] = '\0';
        } else {
            SG_LOG(SG_GENERAL, SG_ALERT, "Unknown runway code "
            << rwyno << " passed to GetReverseRunwayNo(...)");
        }
     }
-    return((string)buf);
+    return(buf);
 }
 
 
@@ -144,16 +152,21 @@ bool FGRunwayList::search( const string& aptid, FGRunway* r ) {
 bool FGRunwayList::search( const string& aptid, const string& rwyno,
                            FGRunway *r )
 {
-    // standardize input number
+    string revrwyno = "";
     string runwayno = rwyno;
-    string tmp = runwayno.substr(1, 1);
-    if (( tmp == "L" || tmp == "R" || tmp == "C" ) || (runwayno.size() == 1)) {
-       tmp = runwayno;
-       runwayno = "0" + tmp;
-        SG_LOG( SG_GENERAL, SG_INFO,
-                "Standardising rwy number from " << tmp << " to " << runwayno );
+    if ( runwayno.length() ) {
+        // standardize input number
+        string tmp = runwayno.substr(1, 1);
+        if (( tmp == "L" || tmp == "R" || tmp == "C" )
+            || (runwayno.size() == 1))
+        {
+            tmp = runwayno;
+            runwayno = "0" + tmp;
+            SG_LOG( SG_GENERAL, SG_INFO, "Standardising rwy number from "
+                    << tmp << " to " << runwayno );
+        }
+        revrwyno = GetReverseRunwayNo(runwayno);
     }
-    string revrwyno = GetReverseRunwayNo(runwayno);
 
     runway_map_iterator pos;
     for ( pos = runways.lower_bound( aptid );
@@ -169,7 +182,9 @@ bool FGRunwayList::search( const string& aptid, const string& rwyno,
             // results if this one matches
             current = pos;
             *r = pos->second;
-           r->rwy_no = revrwyno;
+            // NOTE - matching revrwyno implies that runwayno was
+            // actually correct.
+            r->rwy_no = runwayno;
             r->heading += 180.0;
             string tmp = r->end1_flags;
             r->end1_flags = r->end2_flags;