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"
31 #include "map/subcoord.h"
33 #include "widgets/airport_widget.h"
36 static AirportClassID _selected_airport_class
; ///< the currently visible airport class
37 static int _selected_airport_index
; ///< the index of the selected airport in the current class or -1
38 static byte _selected_airport_layout
; ///< selected airport layout number.
40 static void ShowBuildAirportPicker(Window
*parent
);
42 SpriteID
GetCustomAirportSprite(const AirportSpec
*as
, byte layout
);
44 void CcBuildAirport(const CommandCost
&result
, TileIndex tile
, uint32 p1
, uint32 p2
)
46 if (result
.Failed()) return;
48 if (_settings_client
.sound
.confirm
) SndPlayTileFx(SND_1F_SPLAT_OTHER
, tile
);
49 if (!_settings_client
.gui
.persistent_buildingtools
) ResetPointerMode();
54 * @param tile Position to put the new airport.
56 static void PlaceAirport(TileIndex tile
)
58 if (_selected_airport_index
== -1) return;
59 uint32 p2
= _ctrl_pressed
;
60 SB(p2
, 16, 16, INVALID_STATION
); // no station to join
62 uint32 p1
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
)->GetIndex();
63 p1
|= _selected_airport_layout
<< 8;
64 Command
cmdcont (tile
, p1
, p2
, CMD_BUILD_AIRPORT
);
65 ShowSelectStationIfNeeded (&cmdcont
, TileArea(tile
, _thd
.size
.x
/ TILE_SIZE
, _thd
.size
.y
/ TILE_SIZE
));
68 /** Airport build toolbar window handler. */
69 struct BuildAirToolbarWindow
: Window
{
70 int last_user_action
; // Last started user action.
72 BuildAirToolbarWindow (const WindowDesc
*desc
, WindowNumber window_number
)
73 : Window (desc
), last_user_action (WIDGET_LIST_END
)
75 this->InitNested(window_number
);
76 if (_settings_client
.gui
.link_terraform_toolbar
) ShowTerraformToolbar(this);
79 void OnDelete (void) FINAL_OVERRIDE
81 if (_settings_client
.gui
.link_terraform_toolbar
) DeleteWindowById(WC_SCEN_LAND_GEN
, 0, false);
85 * Some data on this window has become invalid.
86 * @param data Information about the changed data.
87 * @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.
89 virtual void OnInvalidateData(int data
= 0, bool gui_scope
= true)
91 if (!gui_scope
) return;
93 if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT
)) this->Delete();
96 virtual void OnClick(Point pt
, int widget
, int click_count
)
100 if (HandlePlacePushButton (this, WID_AT_AIRPORT
, SPR_CURSOR_AIRPORT
, POINTER_TILE
)) {
101 ShowBuildAirportPicker(this);
102 this->last_user_action
= widget
;
106 case WID_AT_DEMOLISH
:
107 HandlePlacePushButton (this, WID_AT_DEMOLISH
, ANIMCURSOR_DEMOLISH
, POINTER_TILE
);
108 this->last_user_action
= widget
;
116 virtual void OnPlaceObject(Point pt
, TileIndex tile
)
118 switch (this->last_user_action
) {
123 case WID_AT_DEMOLISH
:
124 VpStartPlaceSizing (tile
, VPM_X_AND_Y_ROTATED
);
127 default: NOT_REACHED();
131 void OnPlaceMouseUp (int userdata
, Point pt
, TileIndex start_tile
, TileIndex end_tile
) OVERRIDE
134 HandleDemolishMouseUp (start_tile
, end_tile
);
138 virtual void OnPlaceObjectAbort()
140 this->RaiseButtons();
142 DeleteWindowById(WC_BUILD_STATION
, TRANSPORT_AIR
);
143 DeleteWindowById(WC_SELECT_STATION
, 0);
146 static HotkeyList hotkeys
;
150 * Handler for global hotkeys of the BuildAirToolbarWindow.
151 * @param hotkey Hotkey
152 * @return ES_HANDLED if hotkey was accepted.
154 static EventState
AirportToolbarGlobalHotkeys(int hotkey
)
156 if (_game_mode
!= GM_NORMAL
|| !CanBuildVehicleInfrastructure(VEH_AIRCRAFT
)) return ES_NOT_HANDLED
;
157 Window
*w
= ShowBuildAirToolbar();
158 if (w
== NULL
) return ES_NOT_HANDLED
;
159 return w
->OnHotkey(hotkey
);
162 static const Hotkey airtoolbar_hotkeys
[] = {
163 Hotkey ("airport", WID_AT_AIRPORT
, '1'),
164 Hotkey ("demolish", WID_AT_DEMOLISH
, '2'),
166 HotkeyList
BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys
, AirportToolbarGlobalHotkeys
);
168 static const NWidgetPart _nested_air_toolbar_widgets
[] = {
169 NWidget(NWID_HORIZONTAL
),
170 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
171 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
172 NWidget(WWT_STICKYBOX
, COLOUR_DARK_GREEN
),
174 NWidget(NWID_HORIZONTAL
),
175 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
),
176 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
177 NWidget(WWT_IMGBTN
, COLOUR_DARK_GREEN
, WID_AT_DEMOLISH
), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE
, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC
),
181 static WindowDesc::Prefs
_air_toolbar_prefs ("toolbar_air");
183 static const WindowDesc
_air_toolbar_desc(
184 WDP_ALIGN_TOOLBAR
, 0, 0,
185 WC_BUILD_TOOLBAR
, WC_NONE
,
187 _nested_air_toolbar_widgets
, lengthof(_nested_air_toolbar_widgets
),
188 &_air_toolbar_prefs
, &BuildAirToolbarWindow::hotkeys
192 * Open the build airport toolbar window
194 * If the terraform toolbar is linked to the toolbar, that window is also opened.
196 * @return newly opened airport toolbar, or NULL if the toolbar could not be opened.
198 Window
*ShowBuildAirToolbar()
200 if (!Company::IsValidID(_local_company
)) return NULL
;
202 DeleteWindowByClass(WC_BUILD_TOOLBAR
);
203 return AllocateWindowDescFront
<BuildAirToolbarWindow
>(&_air_toolbar_desc
, TRANSPORT_AIR
);
206 class BuildAirportWindow
: public PickerWindowBase
{
207 SpriteID preview_sprite
; ///< Cached airport preview sprite.
211 /** Build a dropdown list of available airport classes */
212 static DropDownList
*BuildAirportClassDropDown()
214 DropDownList
*list
= new DropDownList();
216 for (uint i
= 0; i
< AirportClass::GetClassCount(); i
++) {
217 *list
->Append() = new DropDownListStringItem(AirportClass::Get((AirportClassID
)i
)->name
, i
, false);
224 BuildAirportWindow (const WindowDesc
*desc
, Window
*parent
)
225 : PickerWindowBase (desc
, parent
),
226 preview_sprite (0), line_height (0), vscroll (NULL
)
228 this->CreateNestedTree();
230 this->vscroll
= this->GetScrollbar(WID_AP_SCROLLBAR
);
231 this->vscroll
->SetCapacity(5);
232 this->vscroll
->SetPosition(0);
234 this->InitNested(TRANSPORT_AIR
);
236 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
237 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
238 this->OnInvalidateData();
240 /* Ensure airport class is valid (changing NewGRFs). */
241 _selected_airport_class
= Clamp(_selected_airport_class
, APC_BEGIN
, (AirportClassID
)(AirportClass::GetClassCount() - 1));
242 const AirportClass
*ac
= AirportClass::Get(_selected_airport_class
);
243 this->vscroll
->SetCount(ac
->GetSpecCount());
245 /* Ensure the airport index is valid for this class (changing NewGRFs). */
246 _selected_airport_index
= Clamp(_selected_airport_index
, -1, ac
->GetSpecCount() - 1);
248 /* Only when no valid airport was selected, we want to select the first airport. */
249 bool selectFirstAirport
= true;
250 if (_selected_airport_index
!= -1) {
251 const AirportSpec
*as
= ac
->GetSpec(_selected_airport_index
);
252 if (as
->IsAvailable()) {
253 /* Ensure the airport layout is valid. */
254 _selected_airport_layout
= Clamp(_selected_airport_layout
, 0, as
->num_table
- 1);
255 selectFirstAirport
= false;
256 this->UpdateSelectSize();
260 if (selectFirstAirport
) this->SelectFirstAvailableAirport(true);
263 void OnDelete (void) FINAL_OVERRIDE
265 DeleteWindowById(WC_SELECT_STATION
, 0);
266 this->PickerWindowBase::OnDelete();
269 virtual void SetStringParameters(int widget
) const
272 case WID_AP_CLASS_DROPDOWN
:
273 SetDParam(0, AirportClass::Get(_selected_airport_class
)->name
);
276 case WID_AP_LAYOUT_NUM
:
277 SetDParam(0, STR_EMPTY
);
278 if (_selected_airport_index
!= -1) {
279 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
280 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_LAYOUT_NAME
);
281 if (string
!= STR_UNDEFINED
) {
282 SetDParam(0, string
);
283 } else if (as
->num_table
> 1) {
284 SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME
);
285 SetDParam(1, _selected_airport_layout
+ 1);
294 virtual void UpdateWidgetSize(int widget
, Dimension
*size
, const Dimension
&padding
, Dimension
*fill
, Dimension
*resize
)
297 case WID_AP_CLASS_DROPDOWN
: {
298 Dimension d
= {0, 0};
299 for (uint i
= 0; i
< AirportClass::GetClassCount(); i
++) {
300 SetDParam(0, AirportClass::Get((AirportClassID
)i
)->name
);
301 d
= maxdim(d
, GetStringBoundingBox(STR_BLACK_STRING
));
303 d
.width
+= padding
.width
;
304 d
.height
+= padding
.height
;
305 *size
= maxdim(*size
, d
);
309 case WID_AP_AIRPORT_LIST
: {
310 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
311 const AirportSpec
*as
= AirportSpec::Get(i
);
312 if (!as
->enabled
) continue;
314 size
->width
= max(size
->width
, GetStringBoundingBox(as
->name
).width
);
317 this->line_height
= FONT_HEIGHT_NORMAL
+ WD_MATRIX_TOP
+ WD_MATRIX_BOTTOM
;
318 size
->height
= 5 * this->line_height
;
322 case WID_AP_AIRPORT_SPRITE
:
323 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
324 const AirportSpec
*as
= AirportSpec::Get(i
);
325 if (!as
->enabled
) continue;
326 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
327 SpriteID sprite
= GetCustomAirportSprite(as
, layout
);
329 Dimension d
= GetSpriteSize(sprite
);
330 d
.width
+= WD_FRAMERECT_LEFT
+ WD_FRAMERECT_RIGHT
;
331 d
.height
+= WD_FRAMERECT_TOP
+ WD_FRAMERECT_BOTTOM
;
332 *size
= maxdim(d
, *size
);
338 case WID_AP_EXTRA_TEXT
:
339 for (int i
= NEW_AIRPORT_OFFSET
; i
< NUM_AIRPORTS
; i
++) {
340 const AirportSpec
*as
= AirportSpec::Get(i
);
341 if (!as
->enabled
) continue;
342 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
343 StringID string
= GetAirportTextCallback(as
, layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
344 if (string
== STR_UNDEFINED
) continue;
346 /* STR_BLACK_STRING is used to start the string with {BLACK} */
347 SetDParam(0, string
);
348 uint h
= GetStringHeight (STR_BLACK_STRING
, size
->width
);
349 size
->height
= max (h
, size
->height
);
358 virtual void DrawWidget(const Rect
&r
, int widget
) const
361 case WID_AP_AIRPORT_LIST
: {
363 AirportClass
*apclass
= AirportClass::Get(_selected_airport_class
);
364 for (uint i
= this->vscroll
->GetPosition(); this->vscroll
->IsVisible(i
) && i
< apclass
->GetSpecCount(); i
++) {
365 const AirportSpec
*as
= apclass
->GetSpec(i
);
366 if (!as
->IsAvailable()) {
367 GfxFillRect(r
.left
+ 1, y
+ 1, r
.right
- 1, y
+ this->line_height
- 2, PC_BLACK
, FILLRECT_CHECKER
);
369 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
);
370 y
+= this->line_height
;
375 case WID_AP_AIRPORT_SPRITE
:
376 if (this->preview_sprite
!= 0) {
377 Dimension d
= GetSpriteSize(this->preview_sprite
);
378 DrawSprite(this->preview_sprite
, COMPANY_SPRITE_COLOUR(_local_company
), (r
.left
+ r
.right
- d
.width
) / 2, (r
.top
+ r
.bottom
- d
.height
) / 2);
382 case WID_AP_EXTRA_TEXT
:
383 if (_selected_airport_index
!= -1) {
384 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
385 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
386 if (string
!= STR_UNDEFINED
) {
387 SetDParam(0, string
);
388 DrawStringMultiLine(r
.left
, r
.right
, r
.top
, r
.bottom
, STR_BLACK_STRING
);
395 virtual void OnPaint()
399 uint16 top
= this->GetWidget
<NWidgetBase
>(WID_AP_BTN_DOHILIGHT
)->pos_y
+ this->GetWidget
<NWidgetBase
>(WID_AP_BTN_DOHILIGHT
)->current_y
+ WD_PAR_VSEP_NORMAL
;
400 NWidgetBase
*panel_nwi
= this->GetWidget
<NWidgetBase
>(WID_AP_BOTTOMPANEL
);
402 int right
= panel_nwi
->pos_x
+ panel_nwi
->current_x
;
403 int bottom
= panel_nwi
->pos_y
+ panel_nwi
->current_y
;
405 if (_selected_airport_index
!= -1) {
406 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
407 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
409 /* only show the station (airport) noise, if the noise option is activated */
410 if (_settings_game
.economy
.station_noise_level
) {
411 /* show the noise of the selected airport */
412 SetDParam(0, as
->noise_level
);
413 DrawString(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, STR_STATION_BUILD_NOISE
);
414 top
+= FONT_HEIGHT_NORMAL
+ WD_PAR_VSEP_NORMAL
;
417 /* strings such as 'Size' and 'Coverage Area' */
418 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, false) + WD_PAR_VSEP_NORMAL
;
419 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, true) + WD_PAR_VSEP_NORMAL
;
422 /* Resize background if the window is too small.
423 * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
424 * (This is the case, if making the window bigger moves the mouse into the window.) */
426 ResizeWindow(this, 0, top
- bottom
, false);
430 void SelectOtherAirport(int airport_index
)
432 _selected_airport_index
= airport_index
;
433 _selected_airport_layout
= 0;
435 this->UpdateSelectSize();
439 void UpdateSelectSize()
441 if (_selected_airport_index
== -1) {
442 SetTileSelectSize(1, 1);
443 this->DisableWidget(WID_AP_LAYOUT_DECREASE
);
444 this->DisableWidget(WID_AP_LAYOUT_INCREASE
);
446 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
449 Direction rotation
= as
->rotation
[_selected_airport_layout
];
450 if (rotation
== DIR_E
|| rotation
== DIR_W
) Swap(w
, h
);
451 SetTileSelectSize(w
, h
);
453 this->preview_sprite
= GetCustomAirportSprite(as
, _selected_airport_layout
);
455 this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE
, _selected_airport_layout
== 0);
456 this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE
, _selected_airport_layout
+ 1 >= as
->num_table
);
458 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
459 if (_settings_client
.gui
.station_show_coverage
) SetTileSelectBigSize(-rad
, -rad
, 2 * rad
, 2 * rad
);
463 virtual void OnClick(Point pt
, int widget
, int click_count
)
466 case WID_AP_CLASS_DROPDOWN
:
467 ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class
, WID_AP_CLASS_DROPDOWN
);
470 case WID_AP_AIRPORT_LIST
: {
471 int num_clicked
= this->vscroll
->GetPosition() + (pt
.y
- this->nested_array
[widget
]->pos_y
) / this->line_height
;
472 if (num_clicked
>= this->vscroll
->GetCount()) break;
473 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(num_clicked
);
474 if (as
->IsAvailable()) this->SelectOtherAirport(num_clicked
);
478 case WID_AP_BTN_DONTHILIGHT
: case WID_AP_BTN_DOHILIGHT
:
479 _settings_client
.gui
.station_show_coverage
= (widget
!= WID_AP_BTN_DONTHILIGHT
);
480 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
481 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
483 if (_settings_client
.sound
.click_beep
) SndPlayFx(SND_15_BEEP
);
484 this->UpdateSelectSize();
487 case WID_AP_LAYOUT_DECREASE
:
488 _selected_airport_layout
--;
489 this->UpdateSelectSize();
493 case WID_AP_LAYOUT_INCREASE
:
494 _selected_airport_layout
++;
495 this->UpdateSelectSize();
502 * Select the first available airport.
503 * @param change_class If true, change the class if no airport in the current
504 * class is available.
506 void SelectFirstAvailableAirport(bool change_class
)
508 /* First try to select an airport in the selected class. */
509 AirportClass
*sel_apclass
= AirportClass::Get(_selected_airport_class
);
510 for (uint i
= 0; i
< sel_apclass
->GetSpecCount(); i
++) {
511 const AirportSpec
*as
= sel_apclass
->GetSpec(i
);
512 if (as
->IsAvailable()) {
513 this->SelectOtherAirport(i
);
518 /* If that fails, select the first available airport
519 * from a random class. */
520 for (AirportClassID j
= APC_BEGIN
; j
< APC_MAX
; j
++) {
521 AirportClass
*apclass
= AirportClass::Get(j
);
522 for (uint i
= 0; i
< apclass
->GetSpecCount(); i
++) {
523 const AirportSpec
*as
= apclass
->GetSpec(i
);
524 if (as
->IsAvailable()) {
525 _selected_airport_class
= j
;
526 this->SelectOtherAirport(i
);
532 /* If all airports are unavailable, select nothing. */
533 this->SelectOtherAirport(-1);
536 virtual void OnDropdownSelect(int widget
, int index
)
538 assert(widget
== WID_AP_CLASS_DROPDOWN
);
539 _selected_airport_class
= (AirportClassID
)index
;
540 this->vscroll
->SetCount(AirportClass::Get(_selected_airport_class
)->GetSpecCount());
541 this->SelectFirstAvailableAirport(false);
544 virtual void OnTick()
546 CheckRedrawStationCoverage(this);
550 static const NWidgetPart _nested_build_airport_widgets
[] = {
551 NWidget(NWID_HORIZONTAL
),
552 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
553 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
555 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetFill(1, 0), SetPIP(2, 0, 2),
556 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL
, STR_NULL
), SetFill(1, 0),
557 NWidget(WWT_DROPDOWN
, COLOUR_GREY
, WID_AP_CLASS_DROPDOWN
), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_STATION_BUILD_AIRPORT_TOOLTIP
),
558 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, WID_AP_AIRPORT_SPRITE
), SetFill(1, 0),
559 NWidget(NWID_HORIZONTAL
),
560 NWidget(WWT_MATRIX
, COLOUR_GREY
, WID_AP_AIRPORT_LIST
), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP
), SetScrollbar(WID_AP_SCROLLBAR
),
561 NWidget(NWID_VSCROLLBAR
, COLOUR_GREY
, WID_AP_SCROLLBAR
),
563 NWidget(NWID_HORIZONTAL
),
564 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, WID_AP_LAYOUT_DECREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE
, STR_NULL
),
565 NWidget(WWT_LABEL
, COLOUR_GREY
, WID_AP_LAYOUT_NUM
), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_NULL
),
566 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, WID_AP_LAYOUT_INCREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE
, STR_NULL
),
568 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, WID_AP_EXTRA_TEXT
), SetFill(1, 0), SetMinimalSize(150, 0),
571 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
, WID_AP_BOTTOMPANEL
), SetPIP(2, 2, 2),
572 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE
, STR_NULL
), SetFill(1, 0),
573 NWidget(NWID_HORIZONTAL
),
574 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
575 NWidget(NWID_HORIZONTAL
, NC_EQUALSIZE
),
576 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, WID_AP_BTN_DONTHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
577 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF
, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP
),
578 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, WID_AP_BTN_DOHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
579 SetDataTip(STR_STATION_BUILD_COVERAGE_ON
, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP
),
581 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
583 NWidget(NWID_SPACER
), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
587 static WindowDesc::Prefs
_build_airport_prefs ("build_station_air");
589 static const WindowDesc
_build_airport_desc(
591 WC_BUILD_STATION
, WC_BUILD_TOOLBAR
,
593 _nested_build_airport_widgets
, lengthof(_nested_build_airport_widgets
),
594 &_build_airport_prefs
597 static void ShowBuildAirportPicker(Window
*parent
)
599 new BuildAirportWindow(&_build_airport_desc
, parent
);
602 void InitializeAirportGui()
604 _selected_airport_class
= APC_BEGIN
;
605 _selected_airport_index
= -1;