Airports
Jon Stockill <[email protected]>
| Newsgroups | gmane.games.flightgear.terragear.devel |
|---|---|
| Message-ID | <Pine.LNX.4.58.0404130349270.6063@architect.internal.stockill.org.uk> |
I've been thinking about the problems we were discussing with airport
generation, hole polys, and multiple runs of genapts, and have come up
with this solution:
#!/usr/bin/perl
use strict;
my $twypath=$ARGV[0];
my $listfile=$ARGV[1]||"/usr/lib/FlightGear/Airports/runways.dat.gz";
my $field;
my $new;
my $current;
open LIST,"zcat $listfile|";
open OUT,">runways.dat";
while (<LIST>)
{ ($field)=(/^. (.*?) /);
if (/^A/)
{ $new=$field;
if (-r "$twypath/$current.twy")
{ open INSERT,"<$twypath/$new.twy";
while (<INSERT>)
{ print OUT;
};
close INSERT;
} else
{ print OUT;
$current=$new;
};
} else
{ print OUT if ($current eq $field);
}
};
close LIST;
close OUT;
exit 0;
Feed it the path to a directory full of taxiway files (as produced by
taxidraw), followed optionally by the path to the airports file (if it's
not on the predefined path) and it will spit out a runways.dat file with
all the updated airfields replacing the original unmodified ones.
Could the solution to our airfield management problem be as simple as
storing twy files in cvs, then updating a local copy, and running this
script followed by genapts?
--
Jon Stockill
[email protected]