]> git.mxchange.org Git - flightgear.git/commitdiff
Fix a bug where FlightGear would crach when an aiport id was geven in lower
authorehofman <ehofman>
Tue, 3 Jun 2003 14:34:02 +0000 (14:34 +0000)
committerehofman <ehofman>
Tue, 3 Jun 2003 14:34:02 +0000 (14:34 +0000)
case. It turned out that MetaKit is case insensitive, so I adden an extra
check to see if we got what we were asking for.

src/Airports/runways.cxx

index ff45f4c7e7e00fe17c31a514d343e0fdb91de38b..5729451cacc947bc9b9ed40beb2f4e1af9e57500 100644 (file)
@@ -145,16 +145,18 @@ bool FGRunways::search( const string& aptid, FGRunway* r ) {
     c4_StringProp pEnd2 ("End2Flags");
 
     int index = vRunway->Find(pID[aptid.c_str()]);
-    // cout << "index = " << index << endl;
+    c4_RowRef row = vRunway->GetAt(index);
+
+    // cout << "index = " << index " row = " << row << endl;
 
-    if ( index == -1 ) {
+    // explicitly check if we got what we were asking for
+    // because metakit is canse insensitive!
+    if ( strcmp(aptid.c_str(), pID(row)) ) {
        return false;
     }
 
     next_index = index + 1;
 
-    c4_RowRef row = vRunway->GetAt(index);
-
     r->id =      (const char *) pID(row);
     r->rwy_no =  (const char *) pRwy(row);
     r->lon =     (double) pLon(row);
@@ -186,10 +188,13 @@ bool FGRunways::search( const string& aptid, const string& rwyno, FGRunway* r )
     c4_StringProp pEnd2 ("End2Flags");
 
     int index = vRunway->Find(pID[aptid.c_str()]);
-    // cout << "index = " << index << endl;
+    c4_RowRef row = vRunway->GetAt(index);
+    // cout << "index = " << index " row = " << row << endl;
 
-    if ( index == -1 ) {
-       return false;
+    // explicitly check if we got what we were asking for
+    // because metakit is canse insensitive!
+    if ( strcmp(aptid.c_str(), pID(row)) ) {
+        return false;
     }
     
     // standardize input number
@@ -201,7 +206,6 @@ bool FGRunways::search( const string& aptid, const string& rwyno, FGRunway* r )
                                      << " to " << runwayno );
     }
 
-    c4_RowRef row = vRunway->GetAt(index);
     string rowid = (const char *) pID(row);
     string rowrwyno = (const char *) pRwy(row);
     while ( rowid == aptid ) {
@@ -504,7 +508,9 @@ bool FGRunwaysUtil::dump_mk4( const string& file ) {
 bool
 FGRunwaysUtil::search( const string& id, FGRunway* a ) const
 {
+cout << "ID " << id << endl;
     const_iterator it = runways.find( FGRunway(id) );
+cout << "it = " << it << " end = " << runways.end() << endl;
     if ( it != runways.end() )
     {
        *a = *it;