Fix a bug where FlightGear would crach when an aiport id was geven in lower
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.
This commit is contained in:
parent
f61dbf1382
commit
32bb2af2af
1 changed files with 14 additions and 8 deletions
|
@ -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);
|
||||
|
||||
if ( index == -1 ) {
|
||||
// cout << "index = " << index " row = " << row << endl;
|
||||
|
||||
// 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,9 +188,12 @@ 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 ) {
|
||||
// explicitly check if we got what we were asking for
|
||||
// because metakit is canse insensitive!
|
||||
if ( strcmp(aptid.c_str(), pID(row)) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue