1 #include <string.h> // strncpy()
3 #include <Main/globals.hxx>
4 #include <Airports/simple.hxx>
6 #include "AirportList.hxx"
9 AirportList::AirportList (int x, int y, int width, int height)
10 : puList(x, y, width, height),
11 _airports(globals->get_airports()),
17 AirportList::~AirportList ()
23 AirportList::create_list ()
28 int num_apt = _airports->size();
29 _content = new char *[num_apt + 1];
32 for (int i = 0; i < num_apt; i++) {
33 const FGAirport *apt = _airports->getAirport(i);
34 STD::string entry(apt->getName() + " (" + apt->getId() + ')');
36 if (!_filter.empty() && entry.find(_filter) == STD::string::npos)
39 _content[n] = new char[entry.size() + 1];
40 strcpy(_content[n], entry.c_str());
48 AirportList::destroy_list ()
50 for (char **c = _content; *c; c++) {
58 AirportList::getListStringValue ()
60 int i = getListIntegerValue();
61 return i < 0 ? 0 : _content[i];
65 AirportList::setValue (const char *s)
67 STD::string filter(s);
68 if (filter != _filter) {
74 // end of AirportList.cxx