--- a/src/airport_gui.cpp Tue Aug 07 01:25:46 2007 +0000
+++ b/src/airport_gui.cpp Tue Aug 07 14:58:55 2007 +0000
@@ -23,22 +23,19 @@
//TODO: remove station.h once converted to newgrf airports. stations just used as temporary loader
#include "station.h"
+
static struct {
byte layout_set;
byte numtracks;
byte platlength;
bool dragdrop;
- bool newstations;
- bool newstation_selected;
FSMportsClassIDByte fsmports_class;
byte station_type;
byte station_count;
- byte direction;
+ DirectionByte direction;
} _airport;
-static byte _selected_airport_type = 0;
-
static void ShowBuildAirportPicker();
@@ -55,7 +52,7 @@
if (_airport.station_type != 0xFF) /*0xFF represents No Airports Available to build */
DoCommandP(tile,
_airport.layout_set | (_airport.numtracks << 8) | (_airport.platlength << 16) | (_ctrl_pressed << 24),
- _selected_airport_type | ((_airport.newstation_selected)? 0x80 : 0x00) | (_airport.fsmports_class << 8) | (_airport.station_type << 16), CcBuildAirport,
+ 0x80 | (_airport.fsmports_class << 8) | (_airport.station_type << 16), CcBuildAirport,
CMD_BUILD_AIRPORT | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE));
}
@@ -167,17 +164,14 @@
{
switch (e->event) {
case WE_CREATE:
- SetWindowWidgetLoweredState(w, 16, !_station_show_coverage);
- SetWindowWidgetLoweredState(w, 17, _station_show_coverage);
- LowerWindowWidget(w, _selected_airport_type + 7);
+ SetWindowWidgetLoweredState(w, 12, !_station_show_coverage);
+ SetWindowWidgetLoweredState(w, 13, _station_show_coverage);
break;
case WE_PAINT: {
- bool newstations = (GetNumFSMportsClasses() != 0);
byte preview_sprite = 0xFF;
- int y_offset;
- FSMportsSpec *fsmportspec = newstations ? GetCustomFSMportsSpec(_airport.fsmports_class, _airport.station_type) : NULL;
+ FSMportsSpec *fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, _airport.station_type);
/* if the port is no longer available, find one that is */
if ((fsmportspec == NULL) || (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0)) {
/* port not available, find new one*/
@@ -191,42 +185,33 @@
}
}
- int i; // airport enabling loop
- uint32 avail_airports;
- const AirportFTAClass *airport;
-
if (WP(w, def_d).close) return;
- airport = GetAirport(_selected_airport_type);
-
- for (byte j = 0; j < 4; j++)
- {
- SetWindowWidgetDisabledState(w, 28 + j, true);
- RaiseWindowWidget(w, 28 + j);
- w->widget[28 + j].data = SPR_IMG_ARROW_NE_WHITE + j; //reset arrows to white
+ for (byte j = 0; j < 4; j++) {
+ SetWindowWidgetDisabledState(w, 8 + j, true);
+ RaiseWindowWidget(w, 8 + j);
+ w->widget[8 + j].data = SPR_IMG_ARROW_NE_WHITE + j; //reset arrows to white
}
- if (_airport.station_type != 0xFF)
- {
+ if (_airport.station_type != 0xFF) {
int x = fsmportspec->size_x[_airport.layout_set];
int y = fsmportspec->size_y[_airport.layout_set];
SetTileSelectSize(x, y);
/* an airport is available, so read it and update screen accordingly */
- for (byte j = 0; j < fsmportspec->numlayouts; j++)
- {
+ for (byte j = 0; j < fsmportspec->numlayouts; j++) {
if (fsmportspec->layouts[j] == NULL) break;
/* enable the permitted orientations */
byte *layout_ptr = (byte*)alloca(x*y + 2);
memcpy(layout_ptr, fsmportspec->layouts[j], (x * y) + 2);
- SetWindowWidgetDisabledState(w, 28 + GB((byte)*layout_ptr,1,2), false);
+ SetWindowWidgetDisabledState(w, 8 + GB((byte)*layout_ptr, 1, 2), false);
if (j == _airport.layout_set) {
layout_ptr++;
preview_sprite = *layout_ptr;
}
}
- LowerWindowWidget(w, 28 + ((_airport.direction - 1) / 2));
- w->widget[28 + ((_airport.direction - 1) / 2)].data = SPR_IMG_ARROW_NE_YELLOW + ((_airport.direction - 1) / 2); //show in yellow
+ LowerWindowWidget(w, 8 + DirToDiagDir(_airport.direction));
+ w->widget[8 + DirToDiagDir(_airport.direction)].data = SPR_IMG_ARROW_NE_YELLOW + DirToDiagDir(_airport.direction); //show in yellow
_thd.airport = _airport.station_type;
_thd.airport_template = true;
@@ -241,34 +226,24 @@
DrawFSMportsTile(9, 106, preview_sprite, _airport.fsmports_class, _airport.station_type);
}
- y_offset = newstations ? 170 : 0;
-
// strings such as 'Size' and 'Coverage Area'
// 'Coverage Area'
- if (_airport.station_type != 0xFF)
- {
- int rad = _patches.modified_catchment ? ((_airport.newstation_selected)? fsmportspec->portFSM->catchment : airport->catchment) : 4;
+ if (_airport.station_type != 0xFF) {
+ int rad = _patches.modified_catchment ? fsmportspec->portFSM->catchment : 4;
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
- DrawStationCoverageAreaText(2, 206 + y_offset, SCT_ALL, rad);
+ DrawStationCoverageAreaText(2, 206, SCT_ALL, rad);
}
- if (newstations) {
- uint16 i;
- uint y = 35;
-
- for (i = w->vscroll.pos; i < _airport.station_count && i < (uint)(w->vscroll.pos + w->vscroll.cap); i++) {
- const FSMportsSpec *fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, i);
+ for (uint16 i = w->vscroll.pos, y = 35; i < _airport.station_count && i < (uint)(w->vscroll.pos + w->vscroll.cap); i++, y += 14) {
+ const FSMportsSpec *fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, i);
- if (fsmportspec != NULL && fsmportspec->name != 0) {
- if (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0) {
- GfxFillRect(8, y - 2, 127, y + 10, (1 << PALETTE_MODIFIER_GREYOUT));
- }
- DrawStringTruncated(9, y, fsmportspec->name, i == _airport.station_type ? 12 : 16, 118);
- } else {
- DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _airport.station_type ? 12 : 16, 118);
+ if (fsmportspec != NULL && fsmportspec->name != 0) {
+ if (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0) {
+ GfxFillRect(8, y - 2, 127, y + 10, (1 << PALETTE_MODIFIER_GREYOUT));
}
-
- y += 14;
+ DrawStringTruncated(9, y, fsmportspec->name, i == _airport.station_type ? 12 : 16, 118);
+ } else {
+ DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _airport.station_type ? 12 : 16, 118);
}
}
@@ -278,27 +253,19 @@
case WE_CLICK: {
switch (e->we.click.widget) {
- case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15:
- RaiseWindowWidget(w, _selected_airport_type + 7);
- _selected_airport_type = e->we.click.widget - 7;
- if (GetNumFSMportsClasses() == 0) _airport.newstation_selected = false;
- LowerWindowWidget(w, _selected_airport_type + 7);
+ case 12: case 13:
+ _station_show_coverage = (e->we.click.widget != 12);
+ SetWindowWidgetLoweredState(w, 12, !_station_show_coverage);
+ SetWindowWidgetLoweredState(w, 13, _station_show_coverage);
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
break;
- case 16: case 17:
- _station_show_coverage = (e->we.click.widget != 16);
- SetWindowWidgetLoweredState(w, 16, !_station_show_coverage);
- SetWindowWidgetLoweredState(w, 17, _station_show_coverage);
- SndPlayFx(SND_15_BEEP);
- SetWindowDirty(w);
- break;
- case 23:
- case 24:
- ShowDropDownMenu(w, BuildFSMportsClassDropdown(), _airport.fsmports_class, 24, 0, 0);
+ case 3:
+ case 4:
+ ShowDropDownMenu(w, BuildFSMportsClassDropdown(), _airport.fsmports_class, 4, 0, 0);
break;
- case 25: {
+ case 5: {
const FSMportsSpec *fsmportspec;
int y = (e->we.click.pt.y - 32) / 14;
@@ -316,26 +283,24 @@
_airport.layout_set = 0;
_airport.platlength= fsmportspec->size_y[_airport.layout_set];
_airport.numtracks = fsmportspec->size_x[_airport.layout_set];
- _airport.newstation_selected = true;
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
break;
}
- case 28: case 29: case 30: case 31:
- w->widget[28 + ((_airport.direction - 1) / 2)].data = SPR_IMG_ARROW_NE_WHITE + ((_airport.direction - 1) / 2); //reset arrow to white
+ case 8: case 9: case 10: case 11:
+ w->widget[8 + DirToDiagDir(_airport.direction)].data = SPR_IMG_ARROW_NE_WHITE + DirToDiagDir(_airport.direction); //reset arrow to white
/* find the layout_set that corresponds to the selected orientation */
FSMportsSpec *fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, _airport.station_type);
_airport.layout_set = 0;
- _airport.direction = (byte)((e->we.click.widget - 28) * 2 + 1);
- for (byte j = 0; j < fsmportspec->numlayouts; j++)
- {
+ _airport.direction = DiagDirToDir((DiagDirection)(e->we.click.widget - 8));
+ for (byte j = 0; j < fsmportspec->numlayouts; j++) {
int x = fsmportspec->size_x[j];
int y = fsmportspec->size_y[j];
if (fsmportspec->layouts[j] == NULL) break;
/* enable the permitted orientations */
- byte *layout_ptr = (byte*)alloca(x*y + 2);
+ byte *layout_ptr = (byte*)alloca(x * y + 2);
memcpy(layout_ptr, fsmportspec->layouts[j], (x * y) + 2);
if (*layout_ptr == _airport.direction) {
_airport.layout_set = j;
@@ -343,10 +308,10 @@
}
}
- SetWindowWidgetLoweredState(w, 28, (_airport.direction == 01));
- SetWindowWidgetLoweredState(w, 29, (_airport.direction == 03));
- SetWindowWidgetLoweredState(w, 30, (_airport.direction == 05));
- SetWindowWidgetLoweredState(w, 31, (_airport.direction == 07));
+ SetWindowWidgetLoweredState(w, 8, (_airport.direction == DIR_NE));
+ SetWindowWidgetLoweredState(w, 9, (_airport.direction == DIR_SE));
+ SetWindowWidgetLoweredState(w, 10, (_airport.direction == DIR_SW));
+ SetWindowWidgetLoweredState(w, 11, (_airport.direction == DIR_NW));
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
break;
@@ -358,7 +323,7 @@
_airport.fsmports_class = (FSMportsClassID)e->we.dropdown.index;
_airport.station_type = 0;
_airport.layout_set = 0;
- _airport.direction = 1;
+ _airport.direction = DIR_NE;
_airport.station_count = GetNumCustomFSMports(_airport.fsmports_class);
w->vscroll.count = _airport.station_count;
@@ -388,70 +353,22 @@
static const Widget _build_airport_picker_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 52, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 53, 89, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 90, 127, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 128, 177, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 178, 239, 0x0, STR_NULL},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 27, 38, STR_SMALL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 65, 76, STR_CITY_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 141, 152, STR_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 77, 88, STR_METRO_AIRPORT , STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 103, 114, STR_INTERNATIONAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 39, 50, STR_COMMUTER_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 165, 176, STR_HELIDEPOT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 115, 126, STR_INTERCONTINENTAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 153, 164, STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
+{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 239, 0x0, STR_NULL},
+{ WWT_INSET, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP},
+{ WWT_TEXTBTN, RESIZE_NONE, 14, 129, 139, 18, 27, STR_0225, STR_SELECT_STATION_CLASS_TIP},
+{ WWT_MATRIX, RESIZE_NONE, 14, 7, 128, 32, 102, 0x501, STR_SELECT_STATION_TYPE_TIP},
+{ WWT_SCROLLBAR, RESIZE_NONE, 14, 129, 140, 32, 102, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
+{ WWT_INSET, RESIZE_NONE, 7, 7, 107, 104, 173, 0x0, STR_NULL},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 104, 119, SPR_IMG_ARROW_NE_WHITE, STR_NULL},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 122, 137, SPR_IMG_ARROW_SE_WHITE, STR_NULL},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 140, 155, SPR_IMG_ARROW_SW_WHITE, STR_NULL},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 158, 173, SPR_IMG_ARROW_NW_WHITE, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 191, 202, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 191, 202, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 14, 27, STR_SMALL_AIRPORTS, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 52, 65, STR_LARGE_AIRPORTS, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 90, 103, STR_HUB_AIRPORTS, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 128, 141, STR_HELIPORTS, STR_NULL},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 178, 191, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
{ WIDGETS_END},
};
-static const Widget _newports_build_airport_picker_widgets[] = {
-{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 222, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 223, 259, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 260, 297, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 298, 347, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 348, 409, 0x0, STR_NULL},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 197, 208, STR_SMALL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 235, 246, STR_CITY_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 311, 322, STR_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 247, 258, STR_METRO_AIRPORT , STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 273, 284, STR_INTERNATIONAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 209, 220, STR_COMMUTER_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 335, 346, STR_HELIDEPOT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 285, 296, STR_INTERCONTINENTAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 323, 334, STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 361, 372, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 361, 372, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 184, 197, STR_SMALL_AIRPORTS, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 222, 235, STR_LARGE_AIRPORTS, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 260, 273, STR_HUB_AIRPORTS, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 298, 311, STR_HELIPORTS, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 348, 361, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
-/* newstations gui additions */
-//TODO: modify for airport specific texts
-{ WWT_INSET, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 129, 139, 18, 27, STR_0225, STR_SELECT_STATION_CLASS_TIP},
-{ WWT_MATRIX, RESIZE_NONE, 14, 7, 128, 32, 102, 0x501, STR_SELECT_STATION_TYPE_TIP},
-{ WWT_SCROLLBAR, RESIZE_NONE, 14, 129, 140, 32, 102, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
-{ WWT_INSET, RESIZE_NONE, 7, 7, 107, 104, 173, 0x0, STR_NULL},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 104, 119, SPR_IMG_ARROW_NE_WHITE, STR_NULL},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 122, 137, SPR_IMG_ARROW_SE_WHITE, STR_NULL},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 140, 155, SPR_IMG_ARROW_SW_WHITE, STR_NULL},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 158, 173, SPR_IMG_ARROW_NW_WHITE, STR_NULL},
-
-
-{ WIDGETS_END},
-};
-
static const WindowDesc _build_airport_desc = {
WDP_AUTO, WDP_AUTO, 148, 240, 148, 240,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
@@ -460,41 +377,24 @@
BuildAirportPickerWndProc
};
-static const WindowDesc _newports_build_airport_desc = {
- WDP_AUTO, WDP_AUTO, 148, 410, 148, 410,
- WC_BUILD_STATION, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
- _newports_build_airport_picker_widgets,
- BuildAirportPickerWndProc
-};
-
static void ShowBuildAirportPicker()
{
- Window *w;
- if (GetNumFSMportsClasses() == 0) {
- w = AllocateWindowDesc(&_build_airport_desc);
- _airport.station_type = 0;
- _airport.newstations = false;
- } else
- {
- w = AllocateWindowDesc(&_newports_build_airport_desc);
- _airport.station_type = 0;
- _airport.layout_set = 0;
- _airport.direction = 1;
- _airport.newstation_selected = true;
- _airport.newstations = true;
- _airport.station_count = GetNumCustomFSMports(_airport.fsmports_class);
- //if (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0) {
- // _airport.station_type = 0;
- //}
+ Window *w = AllocateWindowDesc(&_build_airport_desc);
+ if (w == NULL) return;
- w->vscroll.count = _airport.station_count;
- w->vscroll.cap = 5;
- w->vscroll.pos = clamp(_airport.station_type - 2, 0, w->vscroll.count - w->vscroll.cap);
- }
+ _airport.station_type = 0;
+ _airport.layout_set = 0;
+ _airport.direction = DIR_NE;
+ _airport.station_count = GetNumCustomFSMports(_airport.fsmports_class);
+ //if (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0) {
+ // _airport.station_type = 0;
+ //}
+
+ w->vscroll.count = _airport.station_count;
+ w->vscroll.cap = 5;
+ w->vscroll.pos = clamp(_airport.station_type - 2, 0, w->vscroll.count - w->vscroll.cap);
}
void InitializeAirportGui()
{
- _selected_airport_type = AT_SMALL;
}