diff options
author | Darkvater <darkvater@openttd.org> | 2005-05-09 22:33:00 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-05-09 22:33:00 +0000 |
commit | ab954a934a20e21dc9e2672c380d8a7ab8531d33 (patch) | |
tree | adf0a3467d8519f1ef67e90a0a06731ea8c4dc1a /airport_gui.c | |
parent | 4ad80ae872fe2eea09d431a1d9849936ac37223b (diff) | |
download | openttd-ab954a934a20e21dc9e2672c380d8a7ab8531d33.tar.xz |
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
- CodeChange: changed the airport gui airport-type checking. Added function GetValidAirports() that returns bitmasked availibility, is also used for checking.
- CodeChange: to check tree-planting, 2 const arrays have been moved to table/tree_land.h (type and count)
- CodeChange: added IsTownIndex() in following of IsStationIndex(), etc.
- Fix (regression): road tunnels did not work anymore, forgot that their type was 0x200 (documented now)
Diffstat (limited to 'airport_gui.c')
-rw-r--r-- | airport_gui.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/airport_gui.c b/airport_gui.c index f807ed2ee..cbb904fba 100644 --- a/airport_gui.c +++ b/airport_gui.c @@ -135,24 +135,25 @@ void ShowBuildAirToolbar(void) static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) { - switch(e->event) { + switch (e->event) { case WE_PAINT: { int sel; int rad = 4; // default catchment radious + uint32 avail_airports; - if (WP(w,def_d).close) - return; - w->disabled_state = 0; + if (WP(w,def_d).close) return; sel = _selected_airport_type; - // FIXME -- BuildAirportPickerWndProc - set availability of airports by year, instead of airplane - if (!(_avail_aircraft & 1)) { w->disabled_state |= (1<<3); if (sel == AT_SMALL) sel = AT_LARGE; } - if (!(_avail_aircraft & 2)) { w->disabled_state |= (1<<4); if (sel == AT_LARGE) sel = AT_SMALL; } - if (!(_avail_aircraft & 4)) { w->disabled_state |= (1<<5); } // heliport - // 1980-1-1 is --> 21915 - // 1990-1-1 is --> 25568 - if (_date < 21915) {w->disabled_state |= (1<<6);} // metropilitan airport 1980 - if (_date < 25568) {w->disabled_state |= (1<<7);} // international airport 1990 + avail_airports = GetValidAirports(); + + if (!HASBIT(avail_airports, 0) && sel == AT_SMALL) sel = AT_LARGE; + if (!HASBIT(avail_airports, 1) && sel == AT_LARGE) sel = AT_SMALL; + + /* 'Country Airport' starts at widget 3, and if its bit is set, it is available, + * so take its opposite value to set the disabled_state. There are only 5 available + * airports, so XOr with 0x1F (1 1111) */ + w->disabled_state = (avail_airports ^ 0x1F) << 3; + _selected_airport_type = sel; // select default the coverage area to 'Off' (8) w->click_state = ((1<<3) << sel) | ((1<<8) << _station_show_coverage); |