diff --git a/src/Airports/GenAirports850/main.cxx b/src/Airports/GenAirports850/main.cxx index 783ce0c4..088c1162 100644 --- a/src/Airports/GenAirports850/main.cxx +++ b/src/Airports/GenAirports850/main.cxx @@ -336,7 +336,7 @@ int main(int argc, char **argv) else if ( start_id != "" ) { // scroll forward in datafile - parser->FindAirport( start_id ); + parser->AddAirport( start_id ); // add remaining airports within boundary parser->AddAirports( min_lat, min_lon, max_lat, max_lon ); diff --git a/src/Airports/GenAirports850/parser.cxx b/src/Airports/GenAirports850/parser.cxx index ed9d52c4..9f522e41 100644 --- a/src/Airports/GenAirports850/parser.cxx +++ b/src/Airports/GenAirports850/parser.cxx @@ -93,38 +93,7 @@ void Parser::AddAirport( string icao ) { SG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << line << " at " << cur_pos ); parse_positions.push_back( cur_pos ); - found = true; - } - } -} - -void Parser::FindAirport( string icao ) -{ - char line[2048]; - long cur_pos; - bool found = false; - - ifstream in( filename.c_str() ); - if ( !in.is_open() ) - { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); - exit(-1); - } - - SG_LOG( SG_GENERAL, SG_DEBUG, "Finding airport " << icao ); - while ( !in.eof() && !found ) - { - // remember the position of this line - cur_pos = in.tellg(); - - // get a line - in.getline(line, 2048); - - // this is and airport definition - remember it - if ( IsAirportDefinition( line, icao ) ) - { - SG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << line << " at " << cur_pos ); - parse_positions.push_back( cur_pos ); + airport_icaos.push_back( icao ); found = true; } } @@ -320,7 +289,7 @@ void Parser::Parse() in.clear(); SG_LOG( SG_GENERAL, SG_ALERT, "\n*******************************************************************" ); - SG_LOG( SG_GENERAL, SG_ALERT, "Parsing airport " << airport_icaos[i] << " at " << parse_positions[i] ); + SG_LOG( SG_GENERAL, SG_ALERT, "Parsing airport " << airport_icaos[i] << " at position " << parse_positions[i] ); in.seekg(parse_positions[i], ios::beg); gettimeofday(&parse_start, NULL); diff --git a/src/Airports/GenAirports850/parser.hxx b/src/Airports/GenAirports850/parser.hxx index 41384a13..e7b9be66 100644 --- a/src/Airports/GenAirports850/parser.hxx +++ b/src/Airports/GenAirports850/parser.hxx @@ -84,9 +84,7 @@ public: prev_node = NULL; cur_state = STATE_NONE; } - -// int Parse( char* icao ); - void FindAirport( string icao ); + void AddAirport( string icao ); void AddAirports( float min_lat, float min_lon, float max_lat, float max_lon ); void Parse( void );