- if(argc == 0)
- apt = aptlst->search(lon->getDoubleValue(), lat->getDoubleValue(), airport);
- else if(argc == 1 && naIsString(args[0]))
- apt = aptlst->search(naStr_data(args[0]));
- else if(argc == 2 && naIsNum(args[0]) && naIsNum(args[1]))
- apt = aptlst->search(args[1].num, args[0].num, airport);
- else {
+ if(argc >= 2 && naIsNum(args[0]) && naIsNum(args[1])) {
+ lat = args[0].num;
+ lon = args[1].num;
+ args += 2;
+ argc -= 2;
+ } else {
+ lat = latn->getDoubleValue();
+ lon = lonn->getDoubleValue();
+ }
+ if(argc == 0) {
+ apt = aptlst->search(lon, lat, airport);
+ } else if(argc == 1 && naIsString(args[0])) {
+ const char *s = naStr_data(args[0]);
+ if(!strcmp(s, "airport")) apt = aptlst->search(lon, lat, airport);
+ else if(!strcmp(s, "seaport")) apt = aptlst->search(lon, lat, seaport);
+ else if(!strcmp(s, "heliport")) apt = aptlst->search(lon, lat, heliport);
+ else apt = aptlst->search(s);
+ } else {