2 #include <Main/globals.hxx>
3 #include <Airports/simple.hxx>
5 #include "AirportList.hxx"
8 AirportList::AirportList (int x, int y, int width, int height)
9 : puList(x, y, width, height),
10 _airports(globals->get_airports()),
16 AirportList::~AirportList ()
22 AirportList::create_list ()
27 int num_apt = _airports->size();
28 _content = new char *[num_apt + 1];
31 for (int i = 0; i < num_apt; i++) {
32 const FGAirport *apt = _airports->getAirport(i);
33 STD::string entry(apt->getName() + " (" + apt->getId() + ')');
35 if (!_filter.empty() && entry.find(_filter) == STD::string::npos)
38 _content[n] = new char[entry.size() + 1];
39 strcpy(_content[n], entry.c_str());
47 AirportList::destroy_list ()
49 for (char **c = _content; *c; c++) {
57 AirportList::getListStringValue ()
59 int i = getListIntegerValue();
60 return i < 0 ? 0 : _content[i];
64 AirportList::setValue (const char *s)
66 STD::string filter(s);
67 if (filter != _filter) {
73 // end of AirportList.cxx