133 AllocateWindowDescFront(&_air_toolbar_desc, 0); |
133 AllocateWindowDescFront(&_air_toolbar_desc, 0); |
134 } |
134 } |
135 |
135 |
136 static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) |
136 static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) |
137 { |
137 { |
138 switch(e->event) { |
138 switch (e->event) { |
139 case WE_PAINT: { |
139 case WE_PAINT: { |
140 int sel; |
140 int sel; |
141 int rad = 4; // default catchment radious |
141 int rad = 4; // default catchment radious |
142 |
142 uint32 avail_airports; |
143 if (WP(w,def_d).close) |
143 |
144 return; |
144 if (WP(w,def_d).close) return; |
145 w->disabled_state = 0; |
|
146 |
145 |
147 sel = _selected_airport_type; |
146 sel = _selected_airport_type; |
148 // FIXME -- BuildAirportPickerWndProc - set availability of airports by year, instead of airplane |
147 avail_airports = GetValidAirports(); |
149 if (!(_avail_aircraft & 1)) { w->disabled_state |= (1<<3); if (sel == AT_SMALL) sel = AT_LARGE; } |
148 |
150 if (!(_avail_aircraft & 2)) { w->disabled_state |= (1<<4); if (sel == AT_LARGE) sel = AT_SMALL; } |
149 if (!HASBIT(avail_airports, 0) && sel == AT_SMALL) sel = AT_LARGE; |
151 if (!(_avail_aircraft & 4)) { w->disabled_state |= (1<<5); } // heliport |
150 if (!HASBIT(avail_airports, 1) && sel == AT_LARGE) sel = AT_SMALL; |
152 // 1980-1-1 is --> 21915 |
151 |
153 // 1990-1-1 is --> 25568 |
152 /* 'Country Airport' starts at widget 3, and if its bit is set, it is available, |
154 if (_date < 21915) {w->disabled_state |= (1<<6);} // metropilitan airport 1980 |
153 * so take its opposite value to set the disabled_state. There are only 5 available |
155 if (_date < 25568) {w->disabled_state |= (1<<7);} // international airport 1990 |
154 * airports, so XOr with 0x1F (1 1111) */ |
|
155 w->disabled_state = (avail_airports ^ 0x1F) << 3; |
|
156 |
156 _selected_airport_type = sel; |
157 _selected_airport_type = sel; |
157 // select default the coverage area to 'Off' (8) |
158 // select default the coverage area to 'Off' (8) |
158 w->click_state = ((1<<3) << sel) | ((1<<8) << _station_show_coverage); |
159 w->click_state = ((1<<3) << sel) | ((1<<8) << _station_show_coverage); |
159 SetTileSelectSize(_airport_size_x[sel],_airport_size_y[sel]); |
160 SetTileSelectSize(_airport_size_x[sel],_airport_size_y[sel]); |
160 |
161 |