1 #include <Main/globals.hxx>
2 #include <Airports/simple.hxx>
4 #include "AirportList.hxx"
7 AirportList::AirportList (int x, int y, int width, int height)
8 : puList(x, y, width, height)
12 _airports = globals->get_airports();
13 _nAirports = _airports->size();
15 _content = new char *[_nAirports+1];
16 for (int i = 0; i < _nAirports; i++) {
17 const FGAirport * airport = _airports->getAirport(i);
18 snprintf(buf, 1023, "%s %s\n",
20 airport->name.c_str());
21 int str_len = strlen(buf);
22 _content[i] = new char[(str_len > 1023) ? 1024 : str_len];
23 strncpy(_content[i], buf, 1023);
25 _content[_nAirports] = 0;
29 AirportList::~AirportList ()
31 for (int i = 0; i < _nAirports; i++) {
39 AirportList::getStringValue ()
41 return (char *)_airports->getAirport(getIntegerValue())->id.c_str();
44 // end of AirportList.cxx