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"
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "airport.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"
|
|
|
|
#include "gfx_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"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/sprites.h"
|
|
|
|
#include "table/strings.h"
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
static byte _selected_airport_type;
|
|
|
|
|
2008-05-24 11:19:30 +00:00
|
|
|
static void ShowBuildAirportPicker(Window *parent);
|
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;
|
|
|
|
|
|
|
|
SndPlayTileFx(SND_1F_SPLAT, tile);
|
|
|
|
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceAirport(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2009-01-08 16:35:45 +00:00
|
|
|
uint32 p2 = _ctrl_pressed;
|
|
|
|
SB(p2, 16, 16, INVALID_STATION); // no station to join
|
|
|
|
|
2009-04-21 23:40:56 +00:00
|
|
|
CommandContainer cmdcont = { tile, _selected_airport_type, p2, CMD_BUILD_AIRPORT | CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE), CcBuildAirport, "" };
|
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
|
|
|
}
|
|
|
|
|
2009-05-31 19:51:49 +00:00
|
|
|
/** Widget number of the airport build window. */
|
2006-11-22 16:08:01 +00:00
|
|
|
enum {
|
2009-05-31 19:51:49 +00:00
|
|
|
ATW_AIRPORT,
|
2009-08-02 21:04:15 +00:00
|
|
|
ATW_DEMOLISH,
|
2006-11-22 16:08:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
static void BuildAirClick_Airport(Window *w)
|
|
|
|
{
|
2009-04-19 10:31:30 +00:00
|
|
|
if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT, PlaceAirport)) ShowBuildAirportPicker(w);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void BuildAirClick_Demolish(Window *w)
|
|
|
|
{
|
2009-04-19 10:31:30 +00:00
|
|
|
HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT, PlaceProc_DemolishArea);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
typedef void OnButtonClick(Window *w);
|
|
|
|
static OnButtonClick * const _build_air_button_proc[] = {
|
|
|
|
BuildAirClick_Airport,
|
|
|
|
BuildAirClick_Demolish,
|
|
|
|
};
|
|
|
|
|
2008-05-18 21:34:35 +00:00
|
|
|
struct BuildAirToolbarWindow : Window {
|
2009-08-02 21:04:15 +00:00
|
|
|
BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
|
2008-05-18 21:34:35 +00:00
|
|
|
{
|
2009-08-02 21:04:15 +00:00
|
|
|
this->InitNested(desc, window_number);
|
2008-05-29 15:13:28 +00:00
|
|
|
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
|
{
|
|
|
|
this->DrawWidgets();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
|
{
|
2009-08-13 12:49:51 +00:00
|
|
|
if (!IsInsideBS(widget, ATW_AIRPORT, lengthof(_build_air_button_proc))) return;
|
|
|
|
|
|
|
|
_build_air_button_proc[widget - ATW_AIRPORT](this);
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
|
|
|
|
{
|
|
|
|
switch (keycode) {
|
|
|
|
case '1': BuildAirClick_Airport(this); break;
|
|
|
|
case '2': BuildAirClick_Demolish(this); break;
|
|
|
|
default: return ES_NOT_HANDLED;
|
|
|
|
}
|
|
|
|
return ES_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnPlaceObject(Point pt, TileIndex tile)
|
|
|
|
{
|
|
|
|
_place_proc(tile);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
};
|
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),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_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(),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_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
|
|
|
|
2009-03-15 15:12:06 +00:00
|
|
|
static const WindowDesc _air_toolbar_desc(
|
2009-11-28 15:01:49 +00:00
|
|
|
WDP_ALIGN_TOOLBAR, 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,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowBuildAirToolbar()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2009-05-17 01:00:56 +00:00
|
|
|
if (!Company::IsValidID(_local_company)) return;
|
2006-10-31 21:15:56 +00:00
|
|
|
|
2008-05-04 09:39:16 +00:00
|
|
|
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
2008-05-18 21:34:35 +00:00
|
|
|
AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2009-03-22 21:16:57 +00:00
|
|
|
/** Airport widgets in the airport picker window. */
|
|
|
|
enum AirportPickerWidgets {
|
|
|
|
/* Airport selection buttons. */
|
|
|
|
BAW_SMALL_AIRPORT,
|
|
|
|
BAW_CITY_AIRPORT,
|
|
|
|
BAW_HELIPORT,
|
|
|
|
BAW_METRO_AIRPORT,
|
|
|
|
BAW_INTERNATIONAL_AIRPORT,
|
|
|
|
BAW_COMMUTER_AIRPORT,
|
|
|
|
BAW_HELIDEPOT,
|
|
|
|
BAW_INTERCONTINENTAL_AIRPORT,
|
|
|
|
BAW_HELISTATION,
|
2009-11-24 21:13:36 +00:00
|
|
|
|
|
|
|
BAW_BOTTOMPANEL,
|
2009-03-22 21:16:57 +00:00
|
|
|
BAW_BTN_DONTHILIGHT,
|
|
|
|
BAW_BTN_DOHILIGHT,
|
|
|
|
|
|
|
|
BAW_LAST_AIRPORT = BAW_HELISTATION,
|
|
|
|
BAW_AIRPORT_COUNT = BAW_LAST_AIRPORT - BAW_SMALL_AIRPORT + 1,
|
|
|
|
};
|
2008-05-17 03:31:22 +00:00
|
|
|
|
2009-03-22 21:16:57 +00:00
|
|
|
class AirportPickerWindow : public PickerWindowBase {
|
2008-05-17 03:31:22 +00:00
|
|
|
public:
|
2009-08-02 21:04:15 +00:00
|
|
|
AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
2008-05-17 03:31:22 +00:00
|
|
|
{
|
2009-08-02 21:04:15 +00:00
|
|
|
this->InitNested(desc, TRANSPORT_AIR);
|
2009-01-04 11:11:11 +00:00
|
|
|
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
|
|
|
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
2009-07-05 16:50:56 +00:00
|
|
|
this->OnInvalidateData();
|
2009-07-10 19:41:03 +00:00
|
|
|
this->SelectOtherAirport(_selected_airport_type);
|
2008-05-17 03:31:22 +00:00
|
|
|
}
|
2008-04-10 02:14:14 +00:00
|
|
|
|
2009-01-08 16:35:45 +00:00
|
|
|
virtual ~AirportPickerWindow()
|
|
|
|
{
|
|
|
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-01-15 12:08:08 +00:00
|
|
|
const AirportSpec *as = AirportSpec::Get(_selected_airport_type);
|
|
|
|
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
|
2008-05-17 03:31:22 +00:00
|
|
|
|
2009-09-19 11:31:12 +00:00
|
|
|
uint16 top = this->GetWidget<NWidgetBase>(BAW_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(BAW_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
|
|
|
|
NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(BAW_BOTTOMPANEL);
|
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;
|
2008-05-24 02:54:47 +00:00
|
|
|
/* only show the station (airport) noise, if the noise option is activated */
|
2008-05-29 15:13:28 +00:00
|
|
|
if (_settings_game.economy.station_noise_level) {
|
2008-05-24 02:54:47 +00:00
|
|
|
/* show the noise of the selected airport */
|
2010-01-15 12:08:08 +00:00
|
|
|
SetDParam(0, as->noise_level);
|
2009-08-05 17:59:21 +00:00
|
|
|
DrawString(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_STATION_BUILD_NOISE);
|
2009-07-10 20:48:08 +00:00
|
|
|
top += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
|
2008-05-24 02:54:47 +00:00
|
|
|
}
|
|
|
|
|
2008-05-17 03:31:22 +00:00
|
|
|
/* strings such as 'Size' and 'Coverage Area' */
|
2009-08-02 21:04:15 +00:00
|
|
|
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;
|
|
|
|
/* Resize background if the text is not equally long as the window. */
|
|
|
|
if (top > bottom || (top < bottom && panel_nwi->current_y > panel_nwi->smallest_y)) {
|
|
|
|
ResizeWindow(this, 0, top - bottom);
|
2008-04-10 02:14:14 +00:00
|
|
|
}
|
2008-05-17 03:31:22 +00:00
|
|
|
}
|
2008-04-10 02:14:14 +00:00
|
|
|
|
2009-07-05 16:50:56 +00:00
|
|
|
void SelectOtherAirport(byte airport_id)
|
|
|
|
{
|
|
|
|
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
|
|
|
|
_selected_airport_type = airport_id;
|
|
|
|
this->LowerWidget(airport_id + BAW_SMALL_AIRPORT);
|
|
|
|
|
2010-01-15 12:08:08 +00:00
|
|
|
const AirportSpec *as = AirportSpec::Get(airport_id);
|
|
|
|
SetTileSelectSize(as->size_x, as->size_y);
|
2009-07-05 16:50:56 +00:00
|
|
|
|
2010-01-15 12:08:08 +00:00
|
|
|
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
|
2009-07-05 16:50:56 +00:00
|
|
|
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
|
|
|
|
|
|
|
this->SetDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnInvalidateData(int data = 0)
|
|
|
|
{
|
2010-01-15 12:08:08 +00:00
|
|
|
if (!AirportSpec::Get(_selected_airport_type)->IsAvailable()) {
|
2009-07-05 16:50:56 +00:00
|
|
|
for (int i = 0; i < BAW_AIRPORT_COUNT; i++) {
|
2010-01-15 12:08:08 +00:00
|
|
|
if (AirportSpec::Get(i)->IsAvailable()) {
|
2009-07-05 16:50:56 +00:00
|
|
|
this->SelectOtherAirport(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < BAW_AIRPORT_COUNT; i++) {
|
2010-01-15 12:08:08 +00:00
|
|
|
this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !AirportSpec::Get(i)->IsAvailable());
|
2009-07-05 16:50:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-17 03:31:22 +00:00
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
case BAW_SMALL_AIRPORT: case BAW_CITY_AIRPORT: case BAW_HELIPORT: case BAW_METRO_AIRPORT:
|
2009-03-22 09:58:38 +00:00
|
|
|
case BAW_INTERNATIONAL_AIRPORT: case BAW_COMMUTER_AIRPORT: case BAW_HELIDEPOT:
|
|
|
|
case BAW_INTERCONTINENTAL_AIRPORT: case BAW_HELISTATION:
|
2009-07-05 16:50:56 +00:00
|
|
|
this->SelectOtherAirport(widget - BAW_SMALL_AIRPORT);
|
2008-05-17 03:31:22 +00:00
|
|
|
SndPlayFx(SND_15_BEEP);
|
2009-01-08 16:35:45 +00:00
|
|
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
2008-05-17 03:31:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BAW_BTN_DONTHILIGHT: case BAW_BTN_DOHILIGHT:
|
2009-01-04 11:11:11 +00:00
|
|
|
_settings_client.gui.station_show_coverage = (widget != BAW_BTN_DONTHILIGHT);
|
|
|
|
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
|
|
|
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
2008-05-17 03:31:22 +00:00
|
|
|
SndPlayFx(SND_15_BEEP);
|
2009-07-12 00:14:30 +00:00
|
|
|
this->SelectOtherAirport(_selected_airport_type);
|
2008-05-17 03:31:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-04-10 02:14:14 +00:00
|
|
|
|
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(),
|
|
|
|
/* Small airports. */
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(148, 14), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_AIRPORT_SMALL_AIRPORTS, STR_NULL),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-08-02 21:04:15 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_VERTICAL),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_SMALL_AIRPORT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_SMALL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_COMMUTER_AIRPORT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_COMMUTER_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
2009-08-02 21:04:15 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Large airports. */
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(148, 14), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_AIRPORT_LARGE_AIRPORTS, STR_NULL),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-08-02 21:04:15 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_VERTICAL),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_CITY_AIRPORT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_CITY_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_METRO_AIRPORT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_METRO_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
2009-08-02 21:04:15 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Hub airports. */
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(148, 14), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_AIRPORT_HUB_AIRPORTS, STR_NULL),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
NWidget(NWID_VERTICAL),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_INTERNATIONAL_AIRPORT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_INTERNATIONAL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_INTERCONTINENTAL_AIRPORT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_INTERCONTINENTAL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Heliports. */
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(148, 14), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_AIRPORT_HELIPORTS, STR_NULL),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
NWidget(NWID_VERTICAL),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELIPORT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_HELIPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELISTATION), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_HELISTATION, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELIDEPOT), SetMinimalSize(144, 12), SetFill(1, 0),
|
2009-08-04 18:04:33 +00:00
|
|
|
SetDataTip(STR_STATION_BUILD_AIRPORT_HELIDEPOT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1), SetFill(1, 0),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Bottom panel. */
|
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_BOTTOMPANEL),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(148, 14), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(14, 0),
|
2009-08-02 21:04:15 +00:00
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_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),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_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(),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(14, 0),
|
|
|
|
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(),
|
|
|
|
};
|
|
|
|
|
2009-03-15 15:12:06 +00:00
|
|
|
static const WindowDesc _build_airport_desc(
|
2009-11-28 15:01:49 +00:00
|
|
|
WDP_AUTO, 0, 0,
|
2006-11-10 19:24:14 +00:00
|
|
|
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
2009-11-24 17:28:29 +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
|
|
|
{
|
2008-05-24 11:19:30 +00:00
|
|
|
new AirportPickerWindow(&_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
|
|
|
{
|
|
|
|
_selected_airport_type = AT_SMALL;
|
|
|
|
}
|