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 "widgets/airport_widget.h"
34 #include "safeguards.h"
37 static AirportClassID _selected_airport_class
; ///< the currently visible airport class
38 static int _selected_airport_index
; ///< the index of the selected airport in the current class or -1
39 static byte _selected_airport_layout
; ///< selected airport layout number.
41 static void ShowBuildAirportPicker(Window
*parent
);
43 SpriteID
GetCustomAirportSprite(const AirportSpec
*as
, byte layout
);
45 void CcBuildAirport(const CommandCost
&result
, TileIndex tile
, uint32 p1
, uint32 p2
)
47 if (result
.Failed()) return;
49 if (_settings_client
.sound
.confirm
) SndPlayTileFx(SND_1F_SPLAT_OTHER
, tile
);
50 if (!_settings_client
.gui
.persistent_buildingtools
) ResetObjectToPlace();
55 * @param tile Position to put the new airport.
57 static void PlaceAirport(TileIndex tile
)
59 if (_selected_airport_index
== -1) return;
60 uint32 p2
= _ctrl_pressed
;
61 SB(p2
, 16, 16, INVALID_STATION
); // no station to join
63 uint32 p1
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
)->GetIndex();
64 p1
|= _selected_airport_layout
<< 8;
65 CommandContainer cmdcont
= { tile
, p1
, p2
, CMD_BUILD_AIRPORT
| CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE
), CcBuildAirport
, "" };
66 ShowSelectStationIfNeeded(cmdcont
, TileArea(tile
, _thd
.size
.x
/ TILE_SIZE
, _thd
.size
.y
/ TILE_SIZE
));
69 /** Airport build toolbar window handler. */
70 struct BuildAirToolbarWindow
: Window
{
71 int last_user_action
; // Last started user action.
73 BuildAirToolbarWindow(WindowDesc
*desc
, WindowNumber window_number
) : Window(desc
)
75 this->InitNested(window_number
);
76 if (_settings_client
.gui
.link_terraform_toolbar
) ShowTerraformToolbar(this);
77 this->last_user_action
= WIDGET_LIST_END
;
80 ~BuildAirToolbarWindow()
82 if (_settings_client
.gui
.link_terraform_toolbar
) DeleteWindowById(WC_SCEN_LAND_GEN
, 0, false);
86 * Some data on this window has become invalid.
87 * @param data Information about the changed data.
88 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
90 virtual void OnInvalidateData(int data
= 0, bool gui_scope
= true)
92 if (!gui_scope
) return;
94 if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT
)) delete this;
97 virtual void OnClick(Point pt
, int widget
, int click_count
)
101 if (HandlePlacePushButton(this, WID_AT_AIRPORT
, SPR_CURSOR_AIRPORT
, HT_RECT
)) {
102 ShowBuildAirportPicker(this);
103 this->last_user_action
= widget
;
107 case WID_AT_DEMOLISH
:
108 HandlePlacePushButton(this, WID_AT_DEMOLISH
, ANIMCURSOR_DEMOLISH
, HT_RECT
| HT_DIAGONAL
);
109 this->last_user_action
= widget
;
117 virtual void OnPlaceObject(Point pt
, TileIndex tile
)
119 switch (this->last_user_action
) {
124 case WID_AT_DEMOLISH
:
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 HotkeyList hotkeys
;
156 * Handler for global hotkeys of the BuildAirToolbarWindow.
157 * @param hotkey Hotkey
158 * @return ES_HANDLED if hotkey was accepted.
160 static EventState
AirportToolbarGlobalHotkeys(int hotkey
)
162 if (_game_mode
!= GM_NORMAL
|| !CanBuildVehicleInfrastructure(VEH_AIRCRAFT
)) return ES_NOT_HANDLED
;
163 Window
*w
= ShowBuildAirToolbar();
164 if (w
== NULL
) return ES_NOT_HANDLED
;
165 return w
->OnHotkey(hotkey
);
168 static Hotkey airtoolbar_hotkeys
[] = {
169 Hotkey('1', "airport", WID_AT_AIRPORT
),
170 Hotkey('2', "demolish", WID_AT_DEMOLISH
),
173 HotkeyList
BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys
, AirportToolbarGlobalHotkeys
);
175 static const NWidgetPart _nested_air_toolbar_widgets
[] = {
176 NWidget(NWID_HORIZONTAL
),
177 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
178 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
179 NWidget(WWT_STICKYBOX
, COLOUR_DARK_GREEN
),
181 NWidget(NWID_HORIZONTAL
),
182 NWidget(WWT_IMGBTN
, COLOUR_DARK_GREEN
, WID_AT_AIRPORT
), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT
, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP
),
183 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
184 NWidget(WWT_IMGBTN
, COLOUR_DARK_GREEN
, WID_AT_DEMOLISH
), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE
, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC
),
188 static WindowDesc
_air_toolbar_desc(
189 WDP_ALIGN_TOOLBAR
, "toolbar_air", 0, 0,
190 WC_BUILD_TOOLBAR
, WC_NONE
,
192 _nested_air_toolbar_widgets
, lengthof(_nested_air_toolbar_widgets
),
193 &BuildAirToolbarWindow::hotkeys
197 * Open the build airport toolbar window
199 * If the terraform toolbar is linked to the toolbar, that window is also opened.
201 * @return newly opened airport toolbar, or NULL if the toolbar could not be opened.
203 Window
*ShowBuildAirToolbar()
205 if (!Company::IsValidID(_local_company
)) return NULL
;
207 DeleteWindowByClass(WC_BUILD_TOOLBAR
);
208 return AllocateWindowDescFront
<BuildAirToolbarWindow
>(&_air_toolbar_desc
, TRANSPORT_AIR
);
211 class BuildAirportWindow
: public PickerWindowBase
{
212 SpriteID preview_sprite
; ///< Cached airport preview sprite.
216 /** Build a dropdown list of available airport classes */
217 static DropDownList
*BuildAirportClassDropDown()
219 DropDownList
*list
= new DropDownList();
221 for (uint i
= 0; i
< AirportClass::GetClassCount(); i
++) {
222 *list
->Append() = new DropDownListStringItem(AirportClass::Get((AirportClassID
)i
)->name
, i
, false);
229 BuildAirportWindow(WindowDesc
*desc
, Window
*parent
) : PickerWindowBase(desc
, parent
)
231 this->CreateNestedTree();
233 this->vscroll
= this->GetScrollbar(WID_AP_SCROLLBAR
);
234 this->vscroll
->SetCapacity(5);
235 this->vscroll
->SetPosition(0);
237 this->FinishInitNested(TRANSPORT_AIR
);
239 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
240 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
241 this->OnInvalidateData();
243 /* Ensure airport class is valid (changing NewGRFs). */
244 _selected_airport_class
= Clamp(_selected_airport_class
, APC_BEGIN
, (AirportClassID
)(AirportClass::GetClassCount() - 1));
245 const AirportClass
*ac
= AirportClass::Get(_selected_airport_class
);
246 this->vscroll
->SetCount(ac
->GetSpecCount());
248 /* Ensure the airport index is valid for this class (changing NewGRFs). */
249 _selected_airport_index
= Clamp(_selected_airport_index
, -1, ac
->GetSpecCount() - 1);
251 /* Only when no valid airport was selected, we want to select the first airport. */
252 bool selectFirstAirport
= true;
253 if (_selected_airport_index
!= -1) {
254 const AirportSpec
*as
= ac
->GetSpec(_selected_airport_index
);
255 if (as
->IsAvailable()) {
256 /* Ensure the airport layout is valid. */
257 _selected_airport_layout
= Clamp(_selected_airport_layout
, 0, as
->num_table
- 1);
258 selectFirstAirport
= false;
259 this->UpdateSelectSize();
263 if (selectFirstAirport
) this->SelectFirstAvailableAirport(true);
266 virtual ~BuildAirportWindow()
268 DeleteWindowById(WC_SELECT_STATION
, 0);
271 virtual void SetStringParameters(int widget
) const
274 case WID_AP_CLASS_DROPDOWN
:
275 SetDParam(0, AirportClass::Get(_selected_airport_class
)->name
);
278 case WID_AP_LAYOUT_NUM
:
279 SetDParam(0, STR_EMPTY
);
280 if (_selected_airport_index
!= -1) {
281 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
282 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_LAYOUT_NAME
);
283 if (string
!= STR_UNDEFINED
) {
284 SetDParam(0, string
);
285 } else if (as
->num_table
> 1) {
286 SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME
);
287 SetDParam(1, _selected_airport_layout
+ 1);
296 virtual void UpdateWidgetSize(int widget
, Dimension
*size
, const Dimension
&padding
, Dimension
*fill
, Dimension
*resize
)
299 case WID_AP_CLASS_DROPDOWN
: {
300 Dimension d
= {0, 0};
301 for (uint i
= 0; i
< AirportClass::GetClassCount(); i
++) {
302 SetDParam(0, AirportClass::Get((AirportClassID
)i
)->name
);
303 d
= maxdim(d
, GetStringBoundingBox(STR_BLACK_STRING
));
305 d
.width
+= padding
.width
;
306 d
.height
+= padding
.height
;
307 *size
= maxdim(*size
, d
);
311 case WID_AP_AIRPORT_LIST
: {
312 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
313 const AirportSpec
*as
= AirportSpec::Get(i
);
314 if (!as
->enabled
) continue;
316 size
->width
= max(size
->width
, GetStringBoundingBox(as
->name
).width
);
319 this->line_height
= FONT_HEIGHT_NORMAL
+ WD_MATRIX_TOP
+ WD_MATRIX_BOTTOM
;
320 size
->height
= 5 * this->line_height
;
324 case WID_AP_AIRPORT_SPRITE
:
325 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
326 const AirportSpec
*as
= AirportSpec::Get(i
);
327 if (!as
->enabled
) continue;
328 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
329 SpriteID sprite
= GetCustomAirportSprite(as
, layout
);
331 Dimension d
= GetSpriteSize(sprite
);
332 d
.width
+= WD_FRAMERECT_LEFT
+ WD_FRAMERECT_RIGHT
;
333 d
.height
+= WD_FRAMERECT_TOP
+ WD_FRAMERECT_BOTTOM
;
334 *size
= maxdim(d
, *size
);
340 case WID_AP_EXTRA_TEXT
:
341 for (int i
= NEW_AIRPORT_OFFSET
; i
< NUM_AIRPORTS
; i
++) {
342 const AirportSpec
*as
= AirportSpec::Get(i
);
343 if (!as
->enabled
) continue;
344 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
345 StringID string
= GetAirportTextCallback(as
, layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
346 if (string
== STR_UNDEFINED
) continue;
348 /* STR_BLACK_STRING is used to start the string with {BLACK} */
349 SetDParam(0, string
);
350 Dimension d
= GetStringMultiLineBoundingBox(STR_BLACK_STRING
, *size
);
351 *size
= maxdim(d
, *size
);
360 virtual void DrawWidget(const Rect
&r
, int widget
) const
363 case WID_AP_AIRPORT_LIST
: {
365 AirportClass
*apclass
= AirportClass::Get(_selected_airport_class
);
366 for (uint i
= this->vscroll
->GetPosition(); this->vscroll
->IsVisible(i
) && i
< apclass
->GetSpecCount(); i
++) {
367 const AirportSpec
*as
= apclass
->GetSpec(i
);
368 if (!as
->IsAvailable()) {
369 GfxFillRect(r
.left
+ 1, y
+ 1, r
.right
- 1, y
+ this->line_height
- 2, PC_BLACK
, FILLRECT_CHECKER
);
371 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
);
372 y
+= this->line_height
;
377 case WID_AP_AIRPORT_SPRITE
:
378 if (this->preview_sprite
!= 0) {
379 Dimension d
= GetSpriteSize(this->preview_sprite
);
380 DrawSprite(this->preview_sprite
, COMPANY_SPRITE_COLOUR(_local_company
), (r
.left
+ r
.right
- d
.width
) / 2, (r
.top
+ r
.bottom
- d
.height
) / 2);
384 case WID_AP_EXTRA_TEXT
:
385 if (_selected_airport_index
!= -1) {
386 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
387 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
388 if (string
!= STR_UNDEFINED
) {
389 SetDParam(0, string
);
390 DrawStringMultiLine(r
.left
, r
.right
, r
.top
, r
.bottom
, STR_BLACK_STRING
);
397 virtual void OnPaint()
401 uint16 top
= this->GetWidget
<NWidgetBase
>(WID_AP_BTN_DOHILIGHT
)->pos_y
+ this->GetWidget
<NWidgetBase
>(WID_AP_BTN_DOHILIGHT
)->current_y
+ WD_PAR_VSEP_NORMAL
;
402 NWidgetBase
*panel_nwi
= this->GetWidget
<NWidgetBase
>(WID_AP_BOTTOMPANEL
);
404 int right
= panel_nwi
->pos_x
+ panel_nwi
->current_x
;
405 int bottom
= panel_nwi
->pos_y
+ panel_nwi
->current_y
;
407 if (_selected_airport_index
!= -1) {
408 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
409 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
411 /* only show the station (airport) noise, if the noise option is activated */
412 if (_settings_game
.economy
.station_noise_level
) {
413 /* show the noise of the selected airport */
414 SetDParam(0, as
->noise_level
);
415 DrawString(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, STR_STATION_BUILD_NOISE
);
416 top
+= FONT_HEIGHT_NORMAL
+ WD_PAR_VSEP_NORMAL
;
419 /* strings such as 'Size' and 'Coverage Area' */
420 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, false) + WD_PAR_VSEP_NORMAL
;
421 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, true) + WD_PAR_VSEP_NORMAL
;
424 /* Resize background if the window is too small.
425 * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
426 * (This is the case, if making the window bigger moves the mouse into the window.) */
428 ResizeWindow(this, 0, top
- bottom
, false);
432 void SelectOtherAirport(int airport_index
)
434 _selected_airport_index
= airport_index
;
435 _selected_airport_layout
= 0;
437 this->UpdateSelectSize();
441 void UpdateSelectSize()
443 if (_selected_airport_index
== -1) {
444 SetTileSelectSize(1, 1);
445 this->DisableWidget(WID_AP_LAYOUT_DECREASE
);
446 this->DisableWidget(WID_AP_LAYOUT_INCREASE
);
448 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
451 Direction rotation
= as
->rotation
[_selected_airport_layout
];
452 if (rotation
== DIR_E
|| rotation
== DIR_W
) Swap(w
, h
);
453 SetTileSelectSize(w
, h
);
455 this->preview_sprite
= GetCustomAirportSprite(as
, _selected_airport_layout
);
457 this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE
, _selected_airport_layout
== 0);
458 this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE
, _selected_airport_layout
+ 1 >= as
->num_table
);
460 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
461 if (_settings_client
.gui
.station_show_coverage
) SetTileSelectBigSize(-rad
, -rad
, 2 * rad
, 2 * rad
);
465 virtual void OnClick(Point pt
, int widget
, int click_count
)
468 case WID_AP_CLASS_DROPDOWN
:
469 ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class
, WID_AP_CLASS_DROPDOWN
);
472 case WID_AP_AIRPORT_LIST
: {
473 int num_clicked
= this->vscroll
->GetPosition() + (pt
.y
- this->nested_array
[widget
]->pos_y
) / this->line_height
;
474 if (num_clicked
>= this->vscroll
->GetCount()) break;
475 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(num_clicked
);
476 if (as
->IsAvailable()) this->SelectOtherAirport(num_clicked
);
480 case WID_AP_BTN_DONTHILIGHT
: case WID_AP_BTN_DOHILIGHT
:
481 _settings_client
.gui
.station_show_coverage
= (widget
!= WID_AP_BTN_DONTHILIGHT
);
482 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
483 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
485 if (_settings_client
.sound
.click_beep
) SndPlayFx(SND_15_BEEP
);
486 this->UpdateSelectSize();
489 case WID_AP_LAYOUT_DECREASE
:
490 _selected_airport_layout
--;
491 this->UpdateSelectSize();
495 case WID_AP_LAYOUT_INCREASE
:
496 _selected_airport_layout
++;
497 this->UpdateSelectSize();
504 * Select the first available airport.
505 * @param change_class If true, change the class if no airport in the current
506 * class is available.
508 void SelectFirstAvailableAirport(bool change_class
)
510 /* First try to select an airport in the selected class. */
511 AirportClass
*sel_apclass
= AirportClass::Get(_selected_airport_class
);
512 for (uint i
= 0; i
< sel_apclass
->GetSpecCount(); i
++) {
513 const AirportSpec
*as
= sel_apclass
->GetSpec(i
);
514 if (as
->IsAvailable()) {
515 this->SelectOtherAirport(i
);
520 /* If that fails, select the first available airport
521 * from a random class. */
522 for (AirportClassID j
= APC_BEGIN
; j
< APC_MAX
; j
++) {
523 AirportClass
*apclass
= AirportClass::Get(j
);
524 for (uint i
= 0; i
< apclass
->GetSpecCount(); i
++) {
525 const AirportSpec
*as
= apclass
->GetSpec(i
);
526 if (as
->IsAvailable()) {
527 _selected_airport_class
= j
;
528 this->SelectOtherAirport(i
);
534 /* If all airports are unavailable, select nothing. */
535 this->SelectOtherAirport(-1);
538 virtual void OnDropdownSelect(int widget
, int index
)
540 assert(widget
== WID_AP_CLASS_DROPDOWN
);
541 _selected_airport_class
= (AirportClassID
)index
;
542 this->vscroll
->SetCount(AirportClass::Get(_selected_airport_class
)->GetSpecCount());
543 this->SelectFirstAvailableAirport(false);
546 virtual void OnTick()
548 CheckRedrawStationCoverage(this);
552 static const NWidgetPart _nested_build_airport_widgets
[] = {
553 NWidget(NWID_HORIZONTAL
),
554 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
555 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
557 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetFill(1, 0), SetPIP(2, 0, 2),
558 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL
, STR_NULL
), SetFill(1, 0),
559 NWidget(WWT_DROPDOWN
, COLOUR_GREY
, WID_AP_CLASS_DROPDOWN
), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_STATION_BUILD_AIRPORT_TOOLTIP
),
560 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, WID_AP_AIRPORT_SPRITE
), SetFill(1, 0),
561 NWidget(NWID_HORIZONTAL
),
562 NWidget(WWT_MATRIX
, COLOUR_GREY
, WID_AP_AIRPORT_LIST
), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP
), SetScrollbar(WID_AP_SCROLLBAR
),
563 NWidget(NWID_VSCROLLBAR
, COLOUR_GREY
, WID_AP_SCROLLBAR
),
565 NWidget(NWID_HORIZONTAL
),
566 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, WID_AP_LAYOUT_DECREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE
, STR_NULL
),
567 NWidget(WWT_LABEL
, COLOUR_GREY
, WID_AP_LAYOUT_NUM
), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_NULL
),
568 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, WID_AP_LAYOUT_INCREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE
, STR_NULL
),
570 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, WID_AP_EXTRA_TEXT
), SetFill(1, 0), SetMinimalSize(150, 0),
573 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
, WID_AP_BOTTOMPANEL
), SetPIP(2, 2, 2),
574 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE
, STR_NULL
), SetFill(1, 0),
575 NWidget(NWID_HORIZONTAL
),
576 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
577 NWidget(NWID_HORIZONTAL
, NC_EQUALSIZE
),
578 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, WID_AP_BTN_DONTHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
579 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF
, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP
),
580 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, WID_AP_BTN_DOHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
581 SetDataTip(STR_STATION_BUILD_COVERAGE_ON
, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP
),
583 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
585 NWidget(NWID_SPACER
), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
589 static WindowDesc
_build_airport_desc(
590 WDP_AUTO
, "build_station_air", 0, 0,
591 WC_BUILD_STATION
, WC_BUILD_TOOLBAR
,
593 _nested_build_airport_widgets
, lengthof(_nested_build_airport_widgets
)
596 static void ShowBuildAirportPicker(Window
*parent
)
598 new BuildAirportWindow(&_build_airport_desc
, parent
);
601 void InitializeAirportGui()
603 _selected_airport_class
= APC_BEGIN
;
604 _selected_airport_index
= -1;