1
0
Fork 0

Upgraded to handle new default.apt.gz file.

This commit is contained in:
curt 2001-07-03 16:44:37 +00:00
parent 7ec0025615
commit fe0c17625b
3 changed files with 16 additions and 10 deletions

View file

@ -1,11 +1,15 @@
// dump out a gdbm version of the simple airport file // dump out a gdbm version of the simple airport file
#include <simgear/debug/logstream.hxx>
#include "simple.hxx" #include "simple.hxx"
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
FGAirportsUtil airports; FGAirportsUtil airports;
FGAirport a; FGAirport a;
sglog().setLogLevels( SG_ALL, SG_INFO );
if ( argc == 3 ) { if ( argc == 3 ) {
airports.load( argv[1] ); airports.load( argv[1] );
airports.dump_mk4( argv[2] ); airports.dump_mk4( argv[2] );

View file

@ -232,8 +232,8 @@ int FGRunwaysUtil::load( const string& file ) {
} }
// skip first line of file // skip first line of file
char tmp[256]; char tmp[2048];
in.getline( tmp, 256 ); in.getline( tmp, 2048 );
// read in each line of the file // read in each line of the file

View file

@ -121,12 +121,13 @@ int FGAirportsUtil::load( const string& file ) {
if ( !in.is_open() ) { if ( !in.is_open() ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << file ); SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << file );
exit(-1); exit(-1);
} else {
SG_LOG( SG_GENERAL, SG_ALERT, "opened: " << file );
} }
// skip first line of file // skip first line of file
char tmp[256]; char tmp[2048];
in.getline( tmp, 256 ); in.getline( tmp, 2048 );
// read in each line of the file // read in each line of the file
@ -137,6 +138,7 @@ int FGAirportsUtil::load( const string& file ) {
while ( in.get(c) && c != '\0' ) { while ( in.get(c) && c != '\0' ) {
if ( c == 'A' ) { if ( c == 'A' ) {
in >> a; in >> a;
SG_LOG( SG_GENERAL, SG_INFO, a.id );
in >> skipeol; in >> skipeol;
airports.insert(a); airports.insert(a);
} else if ( c == 'R' ) { } else if ( c == 'R' ) {
@ -150,15 +152,15 @@ int FGAirportsUtil::load( const string& file ) {
#else #else
in >> ::skipws; in >> ::skipws;
string token;
while ( ! in.eof() ) { while ( ! in.eof() ) {
char c = 0; in >> token;
in.get(c); if ( token == "A" ) {
if ( c == 'A' ) {
in >> a; in >> a;
cout << "in <- " << a.id << endl; SG_LOG( SG_GENERAL, SG_INFO, "in <- " << a.id );
in >> skipeol; in >> skipeol;
airports.insert(a); airports.insert(a);
} else if ( c == 'R' ) { } else if ( token == "R" ) {
in >> skipeol; in >> skipeol;
} else { } else {
in >> skipeol; in >> skipeol;