4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
10 /** @file airport_gui.cpp The GUI for airports. */
13 #include "window_gui.h"
14 #include "station_gui.h"
15 #include "terraform_gui.h"
16 #include "sound_func.h"
17 #include "window_func.h"
18 #include "strings_func.h"
19 #include "viewport_func.h"
20 #include "company_func.h"
21 #include "tilehighlight_func.h"
22 #include "company_base.h"
23 #include "station_type.h"
24 #include "newgrf_airport.h"
25 #include "newgrf_callbacks.h"
26 #include "widgets/dropdown_type.h"
27 #include "core/geometry_func.hpp"
29 #include "vehicle_func.h"
32 #include "table/strings.h"
34 static AirportClassID _selected_airport_class
; ///< the currently visible airport class
35 static int _selected_airport_index
; ///< the index of the selected airport in the current class or -1
36 static byte _selected_airport_layout
; ///< selected airport layout number.
38 static void ShowBuildAirportPicker(Window
*parent
);
40 SpriteID
GetCustomAirportSprite(const AirportSpec
*as
, byte layout
);
42 void CcBuildAirport(const CommandCost
&result
, TileIndex tile
, uint32 p1
, uint32 p2
)
44 if (result
.Failed()) return;
46 SndPlayTileFx(SND_1F_SPLAT
, tile
);
47 if (!_settings_client
.gui
.persistent_buildingtools
) ResetObjectToPlace();
52 * @param tile Position to put the new airport.
54 static void PlaceAirport(TileIndex tile
)
56 if (_selected_airport_index
== -1) return;
57 uint32 p2
= _ctrl_pressed
;
58 SB(p2
, 16, 16, INVALID_STATION
); // no station to join
60 uint32 p1
= AirportClass::Get(_selected_airport_class
, _selected_airport_index
)->GetIndex();
61 p1
|= _selected_airport_layout
<< 8;
62 CommandContainer cmdcont
= { tile
, p1
, p2
, CMD_BUILD_AIRPORT
| CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE
), CcBuildAirport
, "" };
63 ShowSelectStationIfNeeded(cmdcont
, TileArea(tile
, _thd
.size
.x
/ TILE_SIZE
, _thd
.size
.y
/ TILE_SIZE
));
66 /** Widget number of the airport build window. */
67 enum AirportToolbarWidgets
{
73 /** Airport build toolbar window handler. */
74 struct BuildAirToolbarWindow
: Window
{
75 int last_user_action
; // Last started user action.
77 BuildAirToolbarWindow(const WindowDesc
*desc
, WindowNumber window_number
) : Window()
79 this->InitNested(desc
, window_number
);
80 if (_settings_client
.gui
.link_terraform_toolbar
) ShowTerraformToolbar(this);
81 this->last_user_action
= WIDGET_LIST_END
;
84 ~BuildAirToolbarWindow()
86 if (_settings_client
.gui
.link_terraform_toolbar
) DeleteWindowById(WC_SCEN_LAND_GEN
, 0, false);
89 virtual void OnClick(Point pt
, int widget
, int click_count
)
93 if (HandlePlacePushButton(this, ATW_AIRPORT
, SPR_CURSOR_AIRPORT
, HT_RECT
)) {
94 ShowBuildAirportPicker(this);
95 this->last_user_action
= widget
;
100 HandlePlacePushButton(this, ATW_DEMOLISH
, ANIMCURSOR_DEMOLISH
, HT_RECT
| HT_DIAGONAL
);
101 this->last_user_action
= widget
;
109 virtual EventState
OnKeyPress(uint16 key
, uint16 keycode
)
111 int num
= CheckHotkeyMatch(airtoolbar_hotkeys
, keycode
, this);
112 if (num
== -1) return ES_NOT_HANDLED
;
113 this->OnClick(Point(), num
, 1);
117 virtual void OnPlaceObject(Point pt
, TileIndex tile
)
119 switch (this->last_user_action
) {
125 PlaceProc_DemolishArea(tile
);
128 default: NOT_REACHED();
132 virtual void OnPlaceDrag(ViewportPlaceMethod select_method
, ViewportDragDropSelectionProcess select_proc
, Point pt
)
134 VpSelectTilesWithMethod(pt
.x
, pt
.y
, select_method
);
137 virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method
, ViewportDragDropSelectionProcess select_proc
, Point pt
, TileIndex start_tile
, TileIndex end_tile
)
139 if (pt
.x
!= -1 && select_proc
== DDSP_DEMOLISH_AREA
) {
140 GUIPlaceProcDragXY(select_proc
, start_tile
, end_tile
);
144 virtual void OnPlaceObjectAbort()
146 this->RaiseButtons();
148 DeleteWindowById(WC_BUILD_STATION
, TRANSPORT_AIR
);
149 DeleteWindowById(WC_SELECT_STATION
, 0);
152 static Hotkey
<BuildAirToolbarWindow
> airtoolbar_hotkeys
[];
155 Hotkey
<BuildAirToolbarWindow
> BuildAirToolbarWindow::airtoolbar_hotkeys
[] = {
156 Hotkey
<BuildAirToolbarWindow
>('1', "airport", ATW_AIRPORT
),
157 Hotkey
<BuildAirToolbarWindow
>('2', "demolish", ATW_DEMOLISH
),
158 HOTKEY_LIST_END(BuildAirToolbarWindow
)
160 Hotkey
<BuildAirToolbarWindow
> *_airtoolbar_hotkeys
= BuildAirToolbarWindow::airtoolbar_hotkeys
;
162 static const NWidgetPart _nested_air_toolbar_widgets
[] = {
163 NWidget(NWID_HORIZONTAL
),
164 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
165 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
166 NWidget(WWT_STICKYBOX
, COLOUR_DARK_GREEN
),
168 NWidget(NWID_HORIZONTAL
),
169 NWidget(WWT_IMGBTN
, COLOUR_DARK_GREEN
, ATW_AIRPORT
), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT
, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP
),
170 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
171 NWidget(WWT_IMGBTN
, COLOUR_DARK_GREEN
, ATW_DEMOLISH
), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE
, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC
),
175 static const WindowDesc
_air_toolbar_desc(
176 WDP_ALIGN_TOOLBAR
, 0, 0,
177 WC_BUILD_TOOLBAR
, WC_NONE
,
179 _nested_air_toolbar_widgets
, lengthof(_nested_air_toolbar_widgets
)
183 * Open the build airport toolbar window
185 * If the terraform toolbar is linked to the toolbar, that window is also opened.
187 * @return newly opened airport toolbar, or NULL if the toolbar could not be opened.
189 Window
*ShowBuildAirToolbar()
191 if (!Company::IsValidID(_local_company
)) return NULL
;
193 DeleteWindowByClass(WC_BUILD_TOOLBAR
);
194 return AllocateWindowDescFront
<BuildAirToolbarWindow
>(&_air_toolbar_desc
, TRANSPORT_AIR
);
197 EventState
AirportToolbarGlobalHotkeys(uint16 key
, uint16 keycode
)
199 if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT
)) return ES_NOT_HANDLED
;
200 int num
= CheckHotkeyMatch
<BuildAirToolbarWindow
>(_airtoolbar_hotkeys
, keycode
, NULL
, true);
201 if (num
== -1) return ES_NOT_HANDLED
;
202 Window
*w
= ShowBuildAirToolbar();
203 if (w
== NULL
) return ES_NOT_HANDLED
;
204 return w
->OnKeyPress(key
, keycode
);
207 /** Airport widgets in the airport picker window. */
208 enum AirportPickerWidgets
{
209 BAIRW_CLASS_DROPDOWN
,
213 BAIRW_LAYOUT_DECREASE
,
214 BAIRW_LAYOUT_INCREASE
,
215 BAIRW_AIRPORT_SPRITE
,
218 BAIRW_COVERAGE_LABEL
,
219 BAIRW_BTN_DONTHILIGHT
,
223 class BuildAirportWindow
: public PickerWindowBase
{
224 SpriteID preview_sprite
; ///< Cached airport preview sprite.
228 /** Build a dropdown list of available airport classes */
229 static DropDownList
*BuildAirportClassDropDown()
231 DropDownList
*list
= new DropDownList();
233 for (uint i
= 0; i
< AirportClass::GetCount(); i
++) {
234 list
->push_back(new DropDownListStringItem(AirportClass::GetName((AirportClassID
)i
), i
, false));
241 BuildAirportWindow(const WindowDesc
*desc
, Window
*parent
) : PickerWindowBase(parent
)
243 this->CreateNestedTree(desc
);
245 this->vscroll
= this->GetScrollbar(BAIRW_SCROLLBAR
);
246 this->vscroll
->SetCapacity(5);
247 this->vscroll
->SetPosition(0);
249 this->FinishInitNested(desc
, TRANSPORT_AIR
);
251 this->SetWidgetLoweredState(BAIRW_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
252 this->SetWidgetLoweredState(BAIRW_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
253 this->OnInvalidateData();
255 this->vscroll
->SetCount(AirportClass::GetCount(_selected_airport_class
));
256 this->SelectFirstAvailableAirport(true);
259 virtual ~BuildAirportWindow()
261 DeleteWindowById(WC_SELECT_STATION
, 0);
264 virtual void SetStringParameters(int widget
) const
267 case BAIRW_CLASS_DROPDOWN
:
268 SetDParam(0, AirportClass::GetName(_selected_airport_class
));
271 case BAIRW_LAYOUT_NUM
:
272 SetDParam(0, STR_EMPTY
);
273 if (_selected_airport_index
!= -1) {
274 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
, _selected_airport_index
);
275 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_LAYOUT_NAME
);
276 if (string
!= STR_UNDEFINED
) {
277 SetDParam(0, string
);
278 } else if (as
->num_table
> 1) {
279 SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME
);
280 SetDParam(1, _selected_airport_layout
+ 1);
289 virtual void UpdateWidgetSize(int widget
, Dimension
*size
, const Dimension
&padding
, Dimension
*fill
, Dimension
*resize
)
292 case BAIRW_CLASS_DROPDOWN
: {
293 Dimension d
= {0, 0};
294 for (uint i
= 0; i
< AirportClass::GetCount(); i
++) {
295 SetDParam(0, AirportClass::GetName((AirportClassID
)i
));
296 d
= maxdim(d
, GetStringBoundingBox(STR_BLACK_STRING
));
298 d
.width
+= padding
.width
;
299 d
.height
+= padding
.height
;
300 *size
= maxdim(*size
, d
);
304 case BAIRW_AIRPORT_LIST
: {
305 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
306 const AirportSpec
*as
= AirportSpec::Get(i
);
307 if (!as
->enabled
) continue;
309 size
->width
= max(size
->width
, GetStringBoundingBox(as
->name
).width
);
312 this->line_height
= FONT_HEIGHT_NORMAL
+ WD_MATRIX_TOP
+ WD_MATRIX_BOTTOM
;
313 size
->height
= this->vscroll
->GetCapacity() * this->line_height
;
317 case BAIRW_AIRPORT_SPRITE
:
318 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
319 const AirportSpec
*as
= AirportSpec::Get(i
);
320 if (!as
->enabled
) continue;
321 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
322 SpriteID sprite
= GetCustomAirportSprite(as
, layout
);
324 Dimension d
= GetSpriteSize(sprite
);
325 d
.width
+= WD_FRAMERECT_LEFT
+ WD_FRAMERECT_RIGHT
;
326 d
.height
+= WD_FRAMERECT_TOP
+ WD_FRAMERECT_BOTTOM
;
327 *size
= maxdim(d
, *size
);
333 case BAIRW_EXTRA_TEXT
:
334 for (int i
= NEW_AIRPORT_OFFSET
; i
< NUM_AIRPORTS
; i
++) {
335 const AirportSpec
*as
= AirportSpec::Get(i
);
336 if (!as
->enabled
) continue;
337 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
338 StringID string
= GetAirportTextCallback(as
, layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
339 if (string
== STR_UNDEFINED
) continue;
341 /* STR_BLACK_STRING is used to start the string with {BLACK} */
342 SetDParam(0, string
);
343 Dimension d
= GetStringMultiLineBoundingBox(STR_BLACK_STRING
, *size
);
344 *size
= maxdim(d
, *size
);
353 virtual void DrawWidget(const Rect
&r
, int widget
) const
356 case BAIRW_AIRPORT_LIST
: {
358 for (uint i
= this->vscroll
->GetPosition(); this->vscroll
->IsVisible(i
) && i
< AirportClass::GetCount(_selected_airport_class
); i
++) {
359 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
, i
);
360 if (!as
->IsAvailable()) {
361 GfxFillRect(r
.left
+ 1, y
+ 1, r
.right
- 1, y
+ this->line_height
- 2, PC_BLACK
, FILLRECT_CHECKER
);
363 DrawString(r
.left
+ WD_MATRIX_LEFT
, r
.right
+ WD_MATRIX_RIGHT
, y
+ WD_MATRIX_TOP
, as
->name
, ((int)i
== _selected_airport_index
) ? TC_WHITE
: TC_BLACK
);
364 y
+= this->line_height
;
369 case BAIRW_AIRPORT_SPRITE
:
370 if (this->preview_sprite
!= 0) {
371 Dimension d
= GetSpriteSize(this->preview_sprite
);
372 DrawSprite(this->preview_sprite
, COMPANY_SPRITE_COLOUR(_local_company
), (r
.left
+ r
.right
- d
.width
) / 2, (r
.top
+ r
.bottom
- d
.height
) / 2);
376 case BAIRW_EXTRA_TEXT
:
377 if (_selected_airport_index
!= -1) {
378 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
, _selected_airport_index
);
379 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
380 if (string
!= STR_UNDEFINED
) {
381 SetDParam(0, string
);
382 DrawStringMultiLine(r
.left
, r
.right
, r
.top
, r
.bottom
, STR_BLACK_STRING
);
389 virtual void OnPaint()
393 uint16 top
= this->GetWidget
<NWidgetBase
>(BAIRW_BTN_DOHILIGHT
)->pos_y
+ this->GetWidget
<NWidgetBase
>(BAIRW_BTN_DOHILIGHT
)->current_y
+ WD_PAR_VSEP_NORMAL
;
394 NWidgetBase
*panel_nwi
= this->GetWidget
<NWidgetBase
>(BAIRW_BOTTOMPANEL
);
396 int right
= panel_nwi
->pos_x
+ panel_nwi
->current_x
;
397 int bottom
= panel_nwi
->pos_y
+ panel_nwi
->current_y
;
399 if (_selected_airport_index
!= -1) {
400 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
, _selected_airport_index
);
401 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
403 /* only show the station (airport) noise, if the noise option is activated */
404 if (_settings_game
.economy
.station_noise_level
) {
405 /* show the noise of the selected airport */
406 SetDParam(0, as
->noise_level
);
407 DrawString(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, STR_STATION_BUILD_NOISE
);
408 top
+= FONT_HEIGHT_NORMAL
+ WD_PAR_VSEP_NORMAL
;
411 /* strings such as 'Size' and 'Coverage Area' */
412 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, false) + WD_PAR_VSEP_NORMAL
;
413 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, true) + WD_PAR_VSEP_NORMAL
;
416 /* Resize background if the text is not equally long as the window. */
417 if (top
> bottom
|| (top
< bottom
&& panel_nwi
->current_y
> panel_nwi
->smallest_y
)) {
418 ResizeWindow(this, 0, top
- bottom
);
422 void SelectOtherAirport(int airport_index
)
424 _selected_airport_index
= airport_index
;
425 _selected_airport_layout
= 0;
427 this->UpdateSelectSize();
431 void UpdateSelectSize()
433 if (_selected_airport_index
== -1) {
434 SetTileSelectSize(1, 1);
435 this->DisableWidget(BAIRW_LAYOUT_DECREASE
);
436 this->DisableWidget(BAIRW_LAYOUT_INCREASE
);
438 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
, _selected_airport_index
);
441 Direction rotation
= as
->rotation
[_selected_airport_layout
];
442 if (rotation
== DIR_E
|| rotation
== DIR_W
) Swap(w
, h
);
443 SetTileSelectSize(w
, h
);
445 this->preview_sprite
= GetCustomAirportSprite(as
, _selected_airport_layout
);
447 this->SetWidgetDisabledState(BAIRW_LAYOUT_DECREASE
, _selected_airport_layout
== 0);
448 this->SetWidgetDisabledState(BAIRW_LAYOUT_INCREASE
, _selected_airport_layout
+ 1 >= as
->num_table
);
450 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
451 if (_settings_client
.gui
.station_show_coverage
) SetTileSelectBigSize(-rad
, -rad
, 2 * rad
, 2 * rad
);
455 virtual void OnClick(Point pt
, int widget
, int click_count
)
458 case BAIRW_CLASS_DROPDOWN
:
459 ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class
, BAIRW_CLASS_DROPDOWN
);
462 case BAIRW_AIRPORT_LIST
: {
463 int num_clicked
= this->vscroll
->GetPosition() + (pt
.y
- this->nested_array
[widget
]->pos_y
) / this->line_height
;
464 if (num_clicked
>= this->vscroll
->GetCount()) break;
465 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
, num_clicked
);
466 if (as
->IsAvailable()) this->SelectOtherAirport(num_clicked
);
470 case BAIRW_BTN_DONTHILIGHT
: case BAIRW_BTN_DOHILIGHT
:
471 _settings_client
.gui
.station_show_coverage
= (widget
!= BAIRW_BTN_DONTHILIGHT
);
472 this->SetWidgetLoweredState(BAIRW_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
473 this->SetWidgetLoweredState(BAIRW_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
475 SndPlayFx(SND_15_BEEP
);
476 this->UpdateSelectSize();
479 case BAIRW_LAYOUT_DECREASE
:
480 _selected_airport_layout
--;
481 this->UpdateSelectSize();
485 case BAIRW_LAYOUT_INCREASE
:
486 _selected_airport_layout
++;
487 this->UpdateSelectSize();
494 * Select the first available airport.
495 * @param change_class If true, change the class if no airport in the current
496 * class is available.
498 void SelectFirstAvailableAirport(bool change_class
)
500 /* First try to select an airport in the selected class. */
501 for (uint i
= 0; i
< AirportClass::GetCount(_selected_airport_class
); i
++) {
502 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
, i
);
503 if (as
->IsAvailable()) {
504 this->SelectOtherAirport(i
);
509 /* If that fails, select the first available airport
510 * from a random class. */
511 for (AirportClassID j
= APC_BEGIN
; j
< APC_MAX
; j
++) {
512 for (uint i
= 0; i
< AirportClass::GetCount(j
); i
++) {
513 const AirportSpec
*as
= AirportClass::Get(j
, i
);
514 if (as
->IsAvailable()) {
515 _selected_airport_class
= j
;
516 this->SelectOtherAirport(i
);
522 /* If all airports are unavailable, select nothing. */
523 this->SelectOtherAirport(-1);
526 virtual void OnDropdownSelect(int widget
, int index
)
528 assert(widget
== BAIRW_CLASS_DROPDOWN
);
529 _selected_airport_class
= (AirportClassID
)index
;
530 this->vscroll
->SetCount(AirportClass::GetCount(_selected_airport_class
));
531 this->SelectFirstAvailableAirport(false);
534 virtual void OnTick()
536 CheckRedrawStationCoverage(this);
540 static const NWidgetPart _nested_build_airport_widgets
[] = {
541 NWidget(NWID_HORIZONTAL
),
542 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
543 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
545 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetFill(1, 0), SetPIP(2, 0, 2),
546 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL
, STR_NULL
), SetFill(1, 0),
547 NWidget(WWT_DROPDOWN
, COLOUR_GREY
, BAIRW_CLASS_DROPDOWN
), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_NULL
),
548 NWidget(NWID_HORIZONTAL
),
549 NWidget(WWT_MATRIX
, COLOUR_GREY
, BAIRW_AIRPORT_LIST
), SetFill(1, 0), SetDataTip(0x501, STR_NULL
), SetScrollbar(BAIRW_SCROLLBAR
),
550 NWidget(NWID_VSCROLLBAR
, COLOUR_GREY
, BAIRW_SCROLLBAR
),
552 NWidget(NWID_HORIZONTAL
),
553 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, BAIRW_LAYOUT_DECREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE
, STR_NULL
),
554 NWidget(WWT_LABEL
, COLOUR_GREY
, BAIRW_LAYOUT_NUM
), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_NULL
),
555 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, BAIRW_LAYOUT_INCREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE
, STR_NULL
),
557 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, BAIRW_AIRPORT_SPRITE
), SetFill(1, 0),
558 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, BAIRW_EXTRA_TEXT
), SetFill(1, 0), SetMinimalSize(150, 0),
561 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
, BAIRW_BOTTOMPANEL
), SetPIP(2, 2, 2),
562 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE
, STR_NULL
), SetFill(1, 0),
563 NWidget(NWID_HORIZONTAL
),
564 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
565 NWidget(NWID_HORIZONTAL
, NC_EQUALSIZE
),
566 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, BAIRW_BTN_DONTHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
567 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF
, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP
),
568 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, BAIRW_BTN_DOHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
569 SetDataTip(STR_STATION_BUILD_COVERAGE_ON
, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP
),
571 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
573 NWidget(NWID_SPACER
), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
577 static const WindowDesc
_build_airport_desc(
579 WC_BUILD_STATION
, WC_BUILD_TOOLBAR
,
580 WDF_CONSTRUCTION
| WDF_UNCLICK_BUTTONS
,
581 _nested_build_airport_widgets
, lengthof(_nested_build_airport_widgets
)
584 static void ShowBuildAirportPicker(Window
*parent
)
586 new BuildAirportWindow(&_build_airport_desc
, parent
);
589 void InitializeAirportGui()
591 _selected_airport_class
= APC_BEGIN
;
592 _selected_airport_index
= -1;