2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file airport_gui.cpp The GUI for airports. */
|
2007-02-23 01:48:53 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "stdafx.h"
|
2007-12-19 20:45:46 +00:00
|
|
|
#include "window_gui.h"
|
|
|
|
#include "station_gui.h"
|
2008-01-06 18:56:43 +00:00
|
|
|
#include "terraform_gui.h"
|
2007-12-29 09:24:26 +00:00
|
|
|
#include "sound_func.h"
|
2007-12-25 11:26:07 +00:00
|
|
|
#include "window_func.h"
|
2008-05-24 02:54:47 +00:00
|
|
|
#include "strings_func.h"
|
2008-01-09 09:45:45 +00:00
|
|
|
#include "viewport_func.h"
|
2008-09-30 20:51:04 +00:00
|
|
|
#include "company_func.h"
|
2008-05-07 13:10:15 +00:00
|
|
|
#include "tilehighlight_func.h"
|
2008-09-30 20:51:04 +00:00
|
|
|
#include "company_base.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "station_type.h"
|
2010-02-22 16:09:26 +00:00
|
|
|
#include "newgrf_airport.h"
|
2010-08-05 12:05:15 +00:00
|
|
|
#include "newgrf_callbacks.h"
|
2010-03-05 23:21:56 +00:00
|
|
|
#include "widgets/dropdown_type.h"
|
|
|
|
#include "core/geometry_func.hpp"
|
2010-07-03 18:10:18 +00:00
|
|
|
#include "hotkeys.h"
|
2011-08-04 17:13:24 +00:00
|
|
|
#include "vehicle_func.h"
|
2013-06-15 15:05:54 +00:00
|
|
|
#include "gui.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2011-12-15 22:22:55 +00:00
|
|
|
#include "widgets/airport_widget.h"
|
|
|
|
|
2014-04-23 20:13:33 +00:00
|
|
|
#include "safeguards.h"
|
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
static AirportClassID _selected_airport_class; ///< the currently visible airport class
|
|
|
|
static int _selected_airport_index; ///< the index of the selected airport in the current class or -1
|
2010-08-05 11:59:07 +00:00
|
|
|
static byte _selected_airport_layout; ///< selected airport layout number.
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-05-24 11:19:30 +00:00
|
|
|
static void ShowBuildAirportPicker(Window *parent);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2010-08-05 12:03:34 +00:00
|
|
|
SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2010-01-11 18:46:09 +00:00
|
|
|
void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2010-01-11 18:46:09 +00:00
|
|
|
if (result.Failed()) return;
|
|
|
|
|
2014-03-23 13:28:32 +00:00
|
|
|
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
|
2010-01-11 18:46:09 +00:00
|
|
|
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2010-12-21 16:27:50 +00:00
|
|
|
/**
|
|
|
|
* Place an airport.
|
|
|
|
* @param tile Position to put the new airport.
|
|
|
|
*/
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceAirport(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2010-03-05 23:21:56 +00:00
|
|
|
if (_selected_airport_index == -1) return;
|
2009-01-08 16:35:45 +00:00
|
|
|
uint32 p2 = _ctrl_pressed;
|
|
|
|
SB(p2, 16, 16, INVALID_STATION); // no station to join
|
|
|
|
|
2012-04-22 16:28:14 +00:00
|
|
|
uint32 p1 = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
|
2010-08-05 11:59:07 +00:00
|
|
|
p1 |= _selected_airport_layout << 8;
|
2015-08-02 18:37:42 +00:00
|
|
|
CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_AIRPORT | CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE), CcBuildAirport, 0, "" };
|
2009-07-26 21:07:03 +00:00
|
|
|
ShowSelectStationIfNeeded(cmdcont, TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE));
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2010-12-21 16:26:34 +00:00
|
|
|
/** Airport build toolbar window handler. */
|
2008-05-18 21:34:35 +00:00
|
|
|
struct BuildAirToolbarWindow : Window {
|
2010-12-21 16:26:34 +00:00
|
|
|
int last_user_action; // Last started user action.
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
BuildAirToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
2008-05-18 21:34:35 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(window_number);
|
2008-05-29 15:13:28 +00:00
|
|
|
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
2010-12-21 16:26:34 +00:00
|
|
|
this->last_user_action = WIDGET_LIST_END;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2008-05-18 21:34:35 +00:00
|
|
|
|
|
|
|
~BuildAirToolbarWindow()
|
|
|
|
{
|
2009-01-02 21:01:27 +00:00
|
|
|
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
|
2015-02-22 15:26:27 +00:00
|
|
|
/**
|
|
|
|
* Some data on this window has become invalid.
|
|
|
|
* @param data Information about the changed data.
|
|
|
|
* @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.
|
|
|
|
*/
|
|
|
|
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
|
|
|
|
{
|
|
|
|
if (!gui_scope) return;
|
|
|
|
|
|
|
|
if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) delete this;
|
|
|
|
}
|
|
|
|
|
2010-01-30 18:34:48 +00:00
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
2008-05-18 21:34:35 +00:00
|
|
|
{
|
2010-12-21 16:26:34 +00:00
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AT_AIRPORT:
|
|
|
|
if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
|
2010-12-21 16:26:34 +00:00
|
|
|
ShowBuildAirportPicker(this);
|
|
|
|
this->last_user_action = widget;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AT_DEMOLISH:
|
|
|
|
HandlePlacePushButton(this, WID_AT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
2010-12-21 16:26:34 +00:00
|
|
|
this->last_user_action = widget;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
}
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virtual void OnPlaceObject(Point pt, TileIndex tile)
|
|
|
|
{
|
2010-12-21 16:27:50 +00:00
|
|
|
switch (this->last_user_action) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AT_AIRPORT:
|
2010-12-21 16:27:50 +00:00
|
|
|
PlaceAirport(tile);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AT_DEMOLISH:
|
2010-12-21 16:27:50 +00:00
|
|
|
PlaceProc_DemolishArea(tile);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: NOT_REACHED();
|
|
|
|
}
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
|
|
|
{
|
|
|
|
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
|
|
|
|
{
|
|
|
|
if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
|
|
|
|
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnPlaceObjectAbort()
|
|
|
|
{
|
|
|
|
this->RaiseButtons();
|
|
|
|
|
2009-07-21 22:25:21 +00:00
|
|
|
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
2009-02-08 16:00:57 +00:00
|
|
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
2010-07-03 18:10:18 +00:00
|
|
|
|
2013-06-15 15:28:09 +00:00
|
|
|
static HotkeyList hotkeys;
|
2010-07-03 18:10:18 +00:00
|
|
|
};
|
|
|
|
|
2013-06-15 15:31:22 +00:00
|
|
|
/**
|
|
|
|
* Handler for global hotkeys of the BuildAirToolbarWindow.
|
|
|
|
* @param hotkey Hotkey
|
|
|
|
* @return ES_HANDLED if hotkey was accepted.
|
|
|
|
*/
|
|
|
|
static EventState AirportToolbarGlobalHotkeys(int hotkey)
|
|
|
|
{
|
|
|
|
if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
|
|
|
|
Window *w = ShowBuildAirToolbar();
|
|
|
|
if (w == NULL) return ES_NOT_HANDLED;
|
|
|
|
return w->OnHotkey(hotkey);
|
|
|
|
}
|
|
|
|
|
2013-06-15 15:28:09 +00:00
|
|
|
static Hotkey airtoolbar_hotkeys[] = {
|
2013-06-15 15:27:33 +00:00
|
|
|
Hotkey('1', "airport", WID_AT_AIRPORT),
|
|
|
|
Hotkey('2', "demolish", WID_AT_DEMOLISH),
|
|
|
|
HOTKEY_LIST_END
|
2008-05-18 21:34:35 +00:00
|
|
|
};
|
2013-06-15 15:31:22 +00:00
|
|
|
HotkeyList BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys, AirportToolbarGlobalHotkeys);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-03-22 21:16:57 +00:00
|
|
|
static const NWidgetPart _nested_air_toolbar_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
|
|
|
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2011-12-16 16:27:45 +00:00
|
|
|
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),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _air_toolbar_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_BUILD_TOOLBAR, WC_NONE,
|
2009-11-24 17:28:29 +00:00
|
|
|
WDF_CONSTRUCTION,
|
2013-06-15 15:30:44 +00:00
|
|
|
_nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets),
|
|
|
|
&BuildAirToolbarWindow::hotkeys
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2010-07-04 09:27:15 +00:00
|
|
|
/**
|
|
|
|
* Open the build airport toolbar window
|
|
|
|
*
|
|
|
|
* If the terraform toolbar is linked to the toolbar, that window is also opened.
|
|
|
|
*
|
|
|
|
* @return newly opened airport toolbar, or NULL if the toolbar could not be opened.
|
|
|
|
*/
|
|
|
|
Window *ShowBuildAirToolbar()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2010-07-04 09:27:15 +00:00
|
|
|
if (!Company::IsValidID(_local_company)) return NULL;
|
2006-10-31 21:15:56 +00:00
|
|
|
|
2008-05-04 09:39:16 +00:00
|
|
|
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
2010-07-04 09:27:15 +00:00
|
|
|
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
class BuildAirportWindow : public PickerWindowBase {
|
2010-08-05 12:03:34 +00:00
|
|
|
SpriteID preview_sprite; ///< Cached airport preview sprite.
|
2010-03-05 23:21:56 +00:00
|
|
|
int line_height;
|
2010-08-12 08:37:01 +00:00
|
|
|
Scrollbar *vscroll;
|
2010-03-05 23:21:56 +00:00
|
|
|
|
|
|
|
/** Build a dropdown list of available airport classes */
|
|
|
|
static DropDownList *BuildAirportClassDropDown()
|
|
|
|
{
|
|
|
|
DropDownList *list = new DropDownList();
|
|
|
|
|
2012-04-22 16:28:19 +00:00
|
|
|
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
|
2013-11-24 14:46:26 +00:00
|
|
|
*list->Append() = new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false);
|
2010-03-05 23:21:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2008-05-17 03:31:22 +00:00
|
|
|
public:
|
2013-05-26 19:23:42 +00:00
|
|
|
BuildAirportWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
2008-05-17 03:31:22 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->CreateNestedTree();
|
2010-08-12 08:37:01 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
|
2010-08-12 08:37:01 +00:00
|
|
|
this->vscroll->SetCapacity(5);
|
|
|
|
this->vscroll->SetPosition(0);
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
this->FinishInitNested(TRANSPORT_AIR);
|
2010-03-05 23:21:56 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
|
|
|
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
2009-07-05 16:50:56 +00:00
|
|
|
this->OnInvalidateData();
|
2010-03-05 23:21:56 +00:00
|
|
|
|
2014-08-15 19:41:57 +00:00
|
|
|
/* Ensure airport class is valid (changing NewGRFs). */
|
|
|
|
_selected_airport_class = Clamp(_selected_airport_class, APC_BEGIN, (AirportClassID)(AirportClass::GetClassCount() - 1));
|
|
|
|
const AirportClass *ac = AirportClass::Get(_selected_airport_class);
|
|
|
|
this->vscroll->SetCount(ac->GetSpecCount());
|
|
|
|
|
|
|
|
/* Ensure the airport index is valid for this class (changing NewGRFs). */
|
|
|
|
_selected_airport_index = Clamp(_selected_airport_index, -1, ac->GetSpecCount() - 1);
|
|
|
|
|
|
|
|
/* Only when no valid airport was selected, we want to select the first airport. */
|
|
|
|
bool selectFirstAirport = true;
|
|
|
|
if (_selected_airport_index != -1) {
|
|
|
|
const AirportSpec *as = ac->GetSpec(_selected_airport_index);
|
|
|
|
if (as->IsAvailable()) {
|
|
|
|
/* Ensure the airport layout is valid. */
|
|
|
|
_selected_airport_layout = Clamp(_selected_airport_layout, 0, as->num_table - 1);
|
|
|
|
selectFirstAirport = false;
|
|
|
|
this->UpdateSelectSize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
|
2008-05-17 03:31:22 +00:00
|
|
|
}
|
2008-04-10 02:14:14 +00:00
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
virtual ~BuildAirportWindow()
|
2009-01-08 16:35:45 +00:00
|
|
|
{
|
|
|
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
|
|
|
}
|
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
virtual void SetStringParameters(int widget) const
|
|
|
|
{
|
2010-08-05 11:59:07 +00:00
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_CLASS_DROPDOWN:
|
2012-04-22 16:27:55 +00:00
|
|
|
SetDParam(0, AirportClass::Get(_selected_airport_class)->name);
|
2010-08-05 11:59:07 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_LAYOUT_NUM:
|
2010-08-05 17:24:45 +00:00
|
|
|
SetDParam(0, STR_EMPTY);
|
2010-08-05 12:05:56 +00:00
|
|
|
if (_selected_airport_index != -1) {
|
2012-04-22 16:28:14 +00:00
|
|
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
|
2010-08-05 12:05:56 +00:00
|
|
|
StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME);
|
2010-08-05 17:24:45 +00:00
|
|
|
if (string != STR_UNDEFINED) {
|
|
|
|
SetDParam(0, string);
|
|
|
|
} else if (as->num_table > 1) {
|
|
|
|
SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
|
|
|
|
SetDParam(1, _selected_airport_layout + 1);
|
|
|
|
}
|
2010-08-05 12:05:56 +00:00
|
|
|
}
|
2010-08-05 11:59:07 +00:00
|
|
|
break;
|
2010-03-05 23:21:56 +00:00
|
|
|
|
2010-08-05 11:59:07 +00:00
|
|
|
default: break;
|
|
|
|
}
|
2010-03-05 23:21:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_CLASS_DROPDOWN: {
|
2010-03-05 23:21:56 +00:00
|
|
|
Dimension d = {0, 0};
|
2012-04-22 16:28:19 +00:00
|
|
|
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
|
2012-04-22 16:27:55 +00:00
|
|
|
SetDParam(0, AirportClass::Get((AirportClassID)i)->name);
|
2010-03-05 23:21:56 +00:00
|
|
|
d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
|
|
|
|
}
|
|
|
|
d.width += padding.width;
|
|
|
|
d.height += padding.height;
|
|
|
|
*size = maxdim(*size, d);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-03-05 23:21:56 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_AIRPORT_LIST: {
|
2010-03-05 23:21:56 +00:00
|
|
|
for (int i = 0; i < NUM_AIRPORTS; i++) {
|
|
|
|
const AirportSpec *as = AirportSpec::Get(i);
|
|
|
|
if (!as->enabled) continue;
|
|
|
|
|
|
|
|
size->width = max(size->width, GetStringBoundingBox(as->name).width);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
|
2013-06-30 14:33:15 +00:00
|
|
|
size->height = 5 * this->line_height;
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-03-05 23:21:56 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_AIRPORT_SPRITE:
|
2010-08-05 12:03:34 +00:00
|
|
|
for (int i = 0; i < NUM_AIRPORTS; i++) {
|
|
|
|
const AirportSpec *as = AirportSpec::Get(i);
|
|
|
|
if (!as->enabled) continue;
|
|
|
|
for (byte layout = 0; layout < as->num_table; layout++) {
|
|
|
|
SpriteID sprite = GetCustomAirportSprite(as, layout);
|
|
|
|
if (sprite != 0) {
|
|
|
|
Dimension d = GetSpriteSize(sprite);
|
|
|
|
d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
|
|
|
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
|
|
|
*size = maxdim(d, *size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_EXTRA_TEXT:
|
2010-08-05 12:05:15 +00:00
|
|
|
for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
|
|
|
|
const AirportSpec *as = AirportSpec::Get(i);
|
|
|
|
if (!as->enabled) continue;
|
|
|
|
for (byte layout = 0; layout < as->num_table; layout++) {
|
|
|
|
StringID string = GetAirportTextCallback(as, layout, CBID_AIRPORT_ADDITIONAL_TEXT);
|
|
|
|
if (string == STR_UNDEFINED) continue;
|
|
|
|
|
|
|
|
/* STR_BLACK_STRING is used to start the string with {BLACK} */
|
|
|
|
SetDParam(0, string);
|
|
|
|
Dimension d = GetStringMultiLineBoundingBox(STR_BLACK_STRING, *size);
|
|
|
|
*size = maxdim(d, *size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void DrawWidget(const Rect &r, int widget) const
|
|
|
|
{
|
2010-08-05 12:03:34 +00:00
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_AIRPORT_LIST: {
|
2010-08-05 12:03:34 +00:00
|
|
|
int y = r.top;
|
2012-04-22 16:28:14 +00:00
|
|
|
AirportClass *apclass = AirportClass::Get(_selected_airport_class);
|
|
|
|
for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < apclass->GetSpecCount(); i++) {
|
|
|
|
const AirportSpec *as = apclass->GetSpec(i);
|
2010-08-05 12:03:34 +00:00
|
|
|
if (!as->IsAvailable()) {
|
2011-05-06 21:13:29 +00:00
|
|
|
GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, PC_BLACK, FILLRECT_CHECKER);
|
2010-08-05 12:03:34 +00:00
|
|
|
}
|
2013-08-18 19:30:25 +00:00
|
|
|
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);
|
2010-08-05 12:03:34 +00:00
|
|
|
y += this->line_height;
|
|
|
|
}
|
|
|
|
break;
|
2010-03-05 23:21:56 +00:00
|
|
|
}
|
2010-08-05 12:03:34 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_AIRPORT_SPRITE:
|
2010-08-05 12:03:34 +00:00
|
|
|
if (this->preview_sprite != 0) {
|
|
|
|
Dimension d = GetSpriteSize(this->preview_sprite);
|
2010-08-05 17:16:31 +00:00
|
|
|
DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), (r.left + r.right - d.width) / 2, (r.top + r.bottom - d.height) / 2);
|
2010-08-05 12:03:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-08-05 12:05:15 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_EXTRA_TEXT:
|
2010-08-05 12:05:15 +00:00
|
|
|
if (_selected_airport_index != -1) {
|
2012-04-22 16:28:14 +00:00
|
|
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
|
2010-08-05 12:05:15 +00:00
|
|
|
StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_ADDITIONAL_TEXT);
|
|
|
|
if (string != STR_UNDEFINED) {
|
|
|
|
SetDParam(0, string);
|
|
|
|
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_BLACK_STRING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-03-05 23:21:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-17 03:31:22 +00:00
|
|
|
virtual void OnPaint()
|
|
|
|
{
|
2009-07-05 16:50:56 +00:00
|
|
|
this->DrawWidgets();
|
2008-05-17 03:31:22 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
uint16 top = this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
|
|
|
|
NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(WID_AP_BOTTOMPANEL);
|
2008-05-17 03:31:22 +00:00
|
|
|
|
2009-08-02 21:04:15 +00:00
|
|
|
int right = panel_nwi->pos_x + panel_nwi->current_x;
|
|
|
|
int bottom = panel_nwi->pos_y + panel_nwi->current_y;
|
2010-03-05 23:21:56 +00:00
|
|
|
|
|
|
|
if (_selected_airport_index != -1) {
|
2012-04-22 16:28:14 +00:00
|
|
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
|
2010-03-05 23:21:56 +00:00
|
|
|
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
|
|
|
|
|
|
|
|
/* only show the station (airport) noise, if the noise option is activated */
|
|
|
|
if (_settings_game.economy.station_noise_level) {
|
|
|
|
/* show the noise of the selected airport */
|
|
|
|
SetDParam(0, as->noise_level);
|
|
|
|
DrawString(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_STATION_BUILD_NOISE);
|
|
|
|
top += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* strings such as 'Size' and 'Coverage Area' */
|
|
|
|
top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
|
|
|
|
top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
|
2008-05-24 02:54:47 +00:00
|
|
|
}
|
|
|
|
|
2013-06-11 18:36:26 +00:00
|
|
|
/* Resize background if the window is too small.
|
|
|
|
* Never make the window smaller to avoid oscillating if the size change affects the acceptance.
|
|
|
|
* (This is the case, if making the window bigger moves the mouse into the window.) */
|
|
|
|
if (top > bottom) {
|
2014-10-12 10:48:18 +00:00
|
|
|
ResizeWindow(this, 0, top - bottom, false);
|
2008-04-10 02:14:14 +00:00
|
|
|
}
|
2008-05-17 03:31:22 +00:00
|
|
|
}
|
2008-04-10 02:14:14 +00:00
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
void SelectOtherAirport(int airport_index)
|
2009-07-05 16:50:56 +00:00
|
|
|
{
|
2010-03-05 23:21:56 +00:00
|
|
|
_selected_airport_index = airport_index;
|
2010-08-05 11:59:07 +00:00
|
|
|
_selected_airport_layout = 0;
|
2009-07-05 16:50:56 +00:00
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
this->UpdateSelectSize();
|
2009-07-05 16:50:56 +00:00
|
|
|
this->SetDirty();
|
|
|
|
}
|
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
void UpdateSelectSize()
|
2009-07-05 16:50:56 +00:00
|
|
|
{
|
2010-03-05 23:21:56 +00:00
|
|
|
if (_selected_airport_index == -1) {
|
|
|
|
SetTileSelectSize(1, 1);
|
2011-12-16 16:27:45 +00:00
|
|
|
this->DisableWidget(WID_AP_LAYOUT_DECREASE);
|
|
|
|
this->DisableWidget(WID_AP_LAYOUT_INCREASE);
|
2010-03-05 23:21:56 +00:00
|
|
|
} else {
|
2012-04-22 16:28:14 +00:00
|
|
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
|
2010-08-05 12:00:09 +00:00
|
|
|
int w = as->size_x;
|
|
|
|
int h = as->size_y;
|
|
|
|
Direction rotation = as->rotation[_selected_airport_layout];
|
|
|
|
if (rotation == DIR_E || rotation == DIR_W) Swap(w, h);
|
|
|
|
SetTileSelectSize(w, h);
|
2010-03-05 23:21:56 +00:00
|
|
|
|
2011-05-27 15:31:54 +00:00
|
|
|
this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0);
|
|
|
|
this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
|
2010-08-05 11:59:07 +00:00
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
|
|
|
|
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
2009-07-05 16:50:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-30 18:34:48 +00:00
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
2008-05-17 03:31:22 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_CLASS_DROPDOWN:
|
|
|
|
ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class, WID_AP_CLASS_DROPDOWN);
|
2008-05-17 03:31:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_AIRPORT_LIST: {
|
2010-08-12 08:37:01 +00:00
|
|
|
int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
|
|
|
|
if (num_clicked >= this->vscroll->GetCount()) break;
|
2012-04-22 16:28:14 +00:00
|
|
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
|
2010-03-05 23:21:56 +00:00
|
|
|
if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-03-05 23:21:56 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_BTN_DONTHILIGHT: case WID_AP_BTN_DOHILIGHT:
|
|
|
|
_settings_client.gui.station_show_coverage = (widget != WID_AP_BTN_DONTHILIGHT);
|
|
|
|
this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
|
|
|
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
2010-03-05 23:21:56 +00:00
|
|
|
this->SetDirty();
|
2012-12-23 21:09:09 +00:00
|
|
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
2010-03-05 23:21:56 +00:00
|
|
|
this->UpdateSelectSize();
|
2008-05-17 03:31:22 +00:00
|
|
|
break;
|
2010-08-05 11:59:07 +00:00
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_LAYOUT_DECREASE:
|
2010-08-05 11:59:07 +00:00
|
|
|
_selected_airport_layout--;
|
|
|
|
this->UpdateSelectSize();
|
|
|
|
this->SetDirty();
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_AP_LAYOUT_INCREASE:
|
2010-08-05 11:59:07 +00:00
|
|
|
_selected_airport_layout++;
|
|
|
|
this->UpdateSelectSize();
|
|
|
|
this->SetDirty();
|
|
|
|
break;
|
2008-05-17 03:31:22 +00:00
|
|
|
}
|
|
|
|
}
|
2008-04-10 02:14:14 +00:00
|
|
|
|
2010-03-05 23:21:56 +00:00
|
|
|
/**
|
|
|
|
* Select the first available airport.
|
|
|
|
* @param change_class If true, change the class if no airport in the current
|
|
|
|
* class is available.
|
|
|
|
*/
|
|
|
|
void SelectFirstAvailableAirport(bool change_class)
|
|
|
|
{
|
|
|
|
/* First try to select an airport in the selected class. */
|
2012-04-22 16:28:14 +00:00
|
|
|
AirportClass *sel_apclass = AirportClass::Get(_selected_airport_class);
|
|
|
|
for (uint i = 0; i < sel_apclass->GetSpecCount(); i++) {
|
|
|
|
const AirportSpec *as = sel_apclass->GetSpec(i);
|
2010-03-05 23:21:56 +00:00
|
|
|
if (as->IsAvailable()) {
|
|
|
|
this->SelectOtherAirport(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (change_class) {
|
|
|
|
/* If that fails, select the first available airport
|
|
|
|
* from a random class. */
|
|
|
|
for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
|
2012-04-22 16:28:14 +00:00
|
|
|
AirportClass *apclass = AirportClass::Get(j);
|
|
|
|
for (uint i = 0; i < apclass->GetSpecCount(); i++) {
|
|
|
|
const AirportSpec *as = apclass->GetSpec(i);
|
2010-03-05 23:21:56 +00:00
|
|
|
if (as->IsAvailable()) {
|
|
|
|
_selected_airport_class = j;
|
|
|
|
this->SelectOtherAirport(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* If all airports are unavailable, select nothing. */
|
|
|
|
this->SelectOtherAirport(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnDropdownSelect(int widget, int index)
|
|
|
|
{
|
2011-12-16 16:27:45 +00:00
|
|
|
assert(widget == WID_AP_CLASS_DROPDOWN);
|
2010-03-05 23:21:56 +00:00
|
|
|
_selected_airport_class = (AirportClassID)index;
|
2012-04-22 16:28:14 +00:00
|
|
|
this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
|
2010-03-05 23:21:56 +00:00
|
|
|
this->SelectFirstAvailableAirport(false);
|
|
|
|
}
|
|
|
|
|
2008-05-17 03:31:22 +00:00
|
|
|
virtual void OnTick()
|
|
|
|
{
|
|
|
|
CheckRedrawStationCoverage(this);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2008-05-17 03:31:22 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-03-22 21:16:57 +00:00
|
|
|
static const NWidgetPart _nested_build_airport_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
2010-08-04 10:33:18 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2013-12-18 18:23:30 +00:00
|
|
|
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
2013-06-30 14:32:31 +00:00
|
|
|
NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
2010-08-05 11:59:07 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
|
|
|
|
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
|
2010-08-05 11:59:07 +00:00
|
|
|
EndContainer(),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Bottom panel. */
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2),
|
2010-08-04 10:33:18 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
2010-08-04 10:33:18 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
|
2009-08-02 21:04:15 +00:00
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
|
2009-08-02 21:04:15 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
|
2009-08-02 21:04:15 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
|
|
|
EndContainer(),
|
2010-08-04 10:33:18 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _build_airport_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_AUTO, "build_station_air", 0, 0,
|
2006-11-10 19:24:14 +00:00
|
|
|
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
2012-11-11 16:10:43 +00:00
|
|
|
WDF_CONSTRUCTION,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_build_airport_widgets, lengthof(_nested_build_airport_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-05-24 11:19:30 +00:00
|
|
|
static void ShowBuildAirportPicker(Window *parent)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2010-03-05 23:21:56 +00:00
|
|
|
new BuildAirportWindow(&_build_airport_desc, parent);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeAirportGui()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2010-03-05 23:21:56 +00:00
|
|
|
_selected_airport_class = APC_BEGIN;
|
2011-06-04 14:48:21 +00:00
|
|
|
_selected_airport_index = -1;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|