summaryrefslogtreecommitdiff
path: root/airport_gui.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-10-03 02:08:15 +0000
committerbelugas <belugas@openttd.org>2006-10-03 02:08:15 +0000
commit753b5724001079c3352d23a911488044884dcf5b (patch)
treedc2a5593c6d3da96528beb914da8807aea2325e7 /airport_gui.c
parente383584988a99dbdfbcd4a63b1f11213a4274355 (diff)
downloadopenttd-753b5724001079c3352d23a911488044884dcf5b.tar.xz
(svn r6619) -Codechange: Use accessors for disabled_state.
Another step toward merging XTDwidget. The only two files not converted (window.h and widget.c) will be done at the very last commit)
Diffstat (limited to 'airport_gui.c')
-rw-r--r--airport_gui.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/airport_gui.c b/airport_gui.c
index de039ad71..b35bfb740 100644
--- a/airport_gui.c
+++ b/airport_gui.c
@@ -143,6 +143,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT: {
+ int i; // airport enabling loop
int sel;
int rad = 4; // default catchment radious
uint32 avail_airports;
@@ -156,10 +157,13 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
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 9 buildable airports, so XOR with 0x01FF (1 1111 1111) */
- w->disabled_state = (avail_airports ^ 0x01FF) << 7;
+ /* 'Country Airport' starts at widget 7, and if its bit is set, it is
+ * available, so take its opposite value to set the disabled state.
+ * There are 9 buildable airports
+ * XXX TODO : all airports should be held in arrays, with all relevant data.
+ * This should be part of newgrf-airports, i suppose
+ */
+ for (i = 0; i < 9; i++) SetWindowWidgetDisabledState(w, i + 7, !HASBIT(avail_airports, i));
_selected_airport_type = sel;
// select default the coverage area to 'Off' (16)