#undef HASHSET
}
-class AirportInfoFilter : public FGPositioned::Filter
+class AirportInfoFilter : public FGAirport::AirportFilter
{
public:
AirportInfoFilter() :
type(FGPositioned::AIRPORT)
{ }
- virtual bool pass(FGPositioned* aPos) const
- {
- return (aPos->type() == type);
+ virtual FGPositioned::Type minType() const {
+ return type;
}
- FGPositioned::Type type;
+ virtual FGPositioned::Type maxType() const {
+ return type;
+ }
+
+ FGPositioned::Type type;
};
// Returns data hash for particular or nearest airport of a <type>, or nil
static SGConstPropertyNode_ptr latn = fgGetNode("/position/latitude-deg", true);
static SGConstPropertyNode_ptr lonn = fgGetNode("/position/longitude-deg", true);
SGGeod pos;
- FGPositionedRef ref;
+ FGAirport* apt = NULL;
if(argc >= 2 && naIsNum(args[0]) && naIsNum(args[1])) {
pos = SGGeod::fromDeg(args[1].num, args[0].num);
else if(!strcmp(s, "heliport")) filter.type = FGPositioned::HELIPORT;
else {
// user provided an <id>, hopefully
- ref = globals->get_airports()->search(s);
- if (!ref) {
+ apt = FGAirport::findByIdent(s);
+ if (!apt) {
naRuntimeError(c, "airportinfo() couldn't find airport:%s", s);
return naNil();
}
return naNil();
}
- if (!ref) {
- ref = FGPositioned::findClosest(pos, maxRange, &filter);
+ if (!apt) {
+ apt = FGAirport::findClosest(pos, maxRange, &filter);
+ if(!apt) return naNil();
}
- if(!ref) return naNil();
- FGAirport *apt = static_cast<FGAirport*>(ref.ptr());
-
string id = apt->ident();
string name = apt->name();