2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
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-13 14:37:30 +00:00
|
|
|
#include "settings_type.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-04-17 19:10:30 +00:00
|
|
|
#include "station_type.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"
|
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
|
|
|
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
if (success) {
|
2004-12-04 09:26:39 +00:00
|
|
|
SndPlayTileFx(SND_1F_SPLAT, tile);
|
2009-01-07 17:40:17 +00:00
|
|
|
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-01-08 16:35:45 +00:00
|
|
|
ShowSelectStationIfNeeded(cmdcont, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-22 16:08:01 +00:00
|
|
|
enum {
|
|
|
|
ATW_AIRPORT = 3,
|
|
|
|
ATW_DEMOLISH = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
|
|
|
|
{
|
|
|
|
this->FindWindowPlacementAndResize(desc);
|
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)
|
|
|
|
{
|
|
|
|
if (widget - 3 >= 0) {
|
|
|
|
_build_air_button_proc[widget - 3](this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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-02-08 16:00:57 +00:00
|
|
|
DeleteWindowById(WC_BUILD_STATION, 0);
|
|
|
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
static const Widget _air_toolbar_widgets[] = {
|
2009-04-21 23:40:56 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW },
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 51, 0, 13, STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS },
|
|
|
|
{ WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 52, 63, 0, 13, 0x0, STR_STICKY_BUTTON },
|
|
|
|
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 41, 14, 35, SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP },
|
|
|
|
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 42, 63, 14, 35, SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC },
|
2004-09-07 21:48:09 +00:00
|
|
|
{ WIDGETS_END},
|
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),
|
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, 0),
|
2009-04-21 23:40:56 +00:00
|
|
|
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, 1), SetMinimalSize(41, 14), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, 2),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-04-21 23:40:56 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, 3), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, 4), 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(
|
2007-07-27 12:49:04 +00:00
|
|
|
WDP_ALIGN_TBR, 22, 64, 36, 64, 36,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_BUILD_TOOLBAR, WC_NONE,
|
2009-02-04 16:59:41 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
|
2009-03-22 21:16:57 +00:00
|
|
|
_air_toolbar_widgets, _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-02-04 16:45:07 +00:00
|
|
|
if (!IsValidCompanyID(_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 {
|
|
|
|
BAW_CLOSEBOX,
|
|
|
|
BAW_CAPTION,
|
|
|
|
/* Panels and labels. */
|
|
|
|
BAW_SMALL_AIRPORTS_PANEL,
|
|
|
|
BAW_SMALL_AIRPORTS_LABEL,
|
|
|
|
BAW_LARGE_AIRPORTS_PANEL,
|
|
|
|
BAW_LARGE_AIRPORTS_LABEL,
|
|
|
|
BAW_HUB_AIRPORTS_PANEL,
|
|
|
|
BAW_HUB_AIRPORTS_LABEL,
|
|
|
|
BAW_HELIPORTS_PANEL,
|
|
|
|
BAW_HELIPORTS_LABEL,
|
|
|
|
BAW_BOTTOMPANEL,
|
|
|
|
/* 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,
|
|
|
|
/* Coverage. */
|
|
|
|
BAW_BTN_DONTHILIGHT,
|
|
|
|
BAW_BTN_DOHILIGHT,
|
|
|
|
BAW_COVERAGE_LABEL,
|
|
|
|
|
|
|
|
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:
|
2008-05-24 11:19:30 +00:00
|
|
|
AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
2008-05-17 03:31:22 +00:00
|
|
|
{
|
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);
|
2008-05-17 03:31:22 +00:00
|
|
|
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
|
|
|
|
|
2008-05-29 15:13:28 +00:00
|
|
|
if (_settings_game.economy.station_noise_level) {
|
2008-05-24 02:54:47 +00:00
|
|
|
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, 10);
|
|
|
|
}
|
|
|
|
|
2008-05-17 03:31:22 +00:00
|
|
|
this->FindWindowPlacementAndResize(desc);
|
|
|
|
}
|
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()
|
|
|
|
{
|
|
|
|
int i; // airport enabling loop
|
2008-05-24 02:54:47 +00:00
|
|
|
uint16 y_noise_offset = 0;
|
2008-05-17 03:31:22 +00:00
|
|
|
uint32 avail_airports;
|
|
|
|
const AirportFTAClass *airport;
|
|
|
|
|
|
|
|
avail_airports = GetValidAirports();
|
|
|
|
|
|
|
|
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
|
|
|
|
if (!HasBit(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE;
|
|
|
|
if (!HasBit(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL;
|
|
|
|
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
|
|
|
|
|
|
|
|
/* 'Country Airport' starts at widget BAW_SMALL_AIRPORT, and if its bit is set, it is
|
|
|
|
* available, so take its opposite value to set the disabled state.
|
|
|
|
* There are 9 buildable airports
|
|
|
|
* XXX TODO : all airports should be held in arrays, with all relevant data.
|
|
|
|
* This should be part of newgrf-airports, i suppose
|
|
|
|
*/
|
|
|
|
for (i = 0; i < BAW_AIRPORT_COUNT; i++) this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !HasBit(avail_airports, i));
|
|
|
|
|
|
|
|
/* select default the coverage area to 'Off' (16) */
|
|
|
|
airport = GetAirport(_selected_airport_type);
|
|
|
|
SetTileSelectSize(airport->size_x, airport->size_y);
|
|
|
|
|
2008-05-29 15:13:28 +00:00
|
|
|
int rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
|
2008-05-17 03:31:22 +00:00
|
|
|
|
2009-01-04 11:11:11 +00:00
|
|
|
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
2008-05-17 03:31:22 +00:00
|
|
|
|
2008-05-17 12:48:06 +00:00
|
|
|
this->DrawWidgets();
|
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 */
|
|
|
|
SetDParam(0, airport->noise_level);
|
2009-04-26 14:52:56 +00:00
|
|
|
DrawString(2, this->width - 2, 206, STR_STATION_NOISE);
|
2008-05-24 02:54:47 +00:00
|
|
|
y_noise_offset = 10;
|
|
|
|
}
|
|
|
|
|
2008-05-17 03:31:22 +00:00
|
|
|
/* strings such as 'Size' and 'Coverage Area' */
|
2008-05-24 02:54:47 +00:00
|
|
|
int text_end = DrawStationCoverageAreaText(2, this->widget[BAW_BTN_DOHILIGHT].bottom + 4 + y_noise_offset, SCT_ALL, rad, false);
|
2008-05-17 03:31:22 +00:00
|
|
|
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
|
|
|
|
if (text_end != this->widget[BAW_BOTTOMPANEL].bottom) {
|
|
|
|
this->SetDirty();
|
|
|
|
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, text_end - this->widget[BAW_BOTTOMPANEL].bottom);
|
|
|
|
this->SetDirty();
|
2008-04-10 02:14:14 +00:00
|
|
|
}
|
2008-05-17 03:31:22 +00:00
|
|
|
}
|
2008-04-10 02:14:14 +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:
|
2008-05-17 03:31:22 +00:00
|
|
|
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
|
|
|
|
_selected_airport_type = widget - BAW_SMALL_AIRPORT;
|
|
|
|
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
|
|
|
|
SndPlayFx(SND_15_BEEP);
|
|
|
|
this->SetDirty();
|
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);
|
|
|
|
this->SetDirty();
|
|
|
|
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
|
|
|
|
|
|
|
static const Widget _build_airport_picker_widgets[] = {
|
2009-04-21 23:40:56 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // BAW_CLOSEBOX
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 147, 0, 13, STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // BAW_CAPTION
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 14, 52, 0x0, STR_NULL}, // BAW_SMALL_AIRPORTS_PANEL
|
|
|
|
{ WWT_LABEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 14, 27, STR_SMALL_AIRPORTS, STR_NULL}, // BAW_SMALL_AIRPORTS_LABEL
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 53, 91, 0x0, STR_NULL}, // BAW_LARGE_AIRPORTS_PANEL
|
|
|
|
{ WWT_LABEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 53, 66, STR_LARGE_AIRPORTS, STR_NULL}, // BAW_LARGE_AIRPORTS_LABEL
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 92, 130, 0x0, STR_NULL}, // BAW_HUB_AIRPORTS_PANEL
|
|
|
|
{ WWT_LABEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 92, 105, STR_HUB_AIRPORTS, STR_NULL}, // BAW_HUB_AIRPORTS_LABEL
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 131, 181, 0x0, STR_NULL}, // BAW_HELIPORTS_PANEL
|
|
|
|
{ WWT_LABEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 131, 144, STR_HELIPORTS, STR_NULL}, // BAW_HELIPORTS_LABEL
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 182, 244, 0x0, STR_NULL}, // BAW_BOTTOMPANEL
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 28, 39, STR_SMALL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_SMALL_AIRPORT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 67, 78, STR_CITY_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_CITY_AIRPORT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 145, 156, STR_HELIPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_HELIPORT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 79, 90, STR_METRO_AIRPORT , STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_METRO_AIRPORT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 106, 117, STR_INTERNATIONAL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_INTERNATIONAL_AIRPORT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 40, 51, STR_COMMUTER_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_COMMUTER_AIRPORT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 169, 180, STR_HELIDEPOT, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_HELIDEPOT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 118, 129, STR_INTERCONTINENTAL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_INTERCONTINENTAL_AIRPORT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 145, 157, 168, STR_HELISTATION, STR_STATION_BUILD_AIRPORT_TOOLTIP}, // BAW_HELISTATION
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 14, 73, 196, 207, STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP}, // BAW_BTN_DONTHILIGHT
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 74, 133, 196, 207, STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP}, // BAW_BTN_DOHILIGHT
|
|
|
|
{ WWT_LABEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 147, 182, 195, STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL}, // BAW_COVERAGE_LABEL
|
2004-09-07 21:48:09 +00:00
|
|
|
{ WIDGETS_END},
|
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),
|
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BAW_CLOSEBOX),
|
2009-04-21 23:40:56 +00:00
|
|
|
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BAW_CAPTION), SetMinimalSize(137, 14), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
2009-03-22 21:16:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Small airports. */
|
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_SMALL_AIRPORTS_PANEL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_SMALL_AIRPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_SMALL_AIRPORTS, STR_NULL),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
|
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_SMALL_AIRPORT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_SMALL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_COMMUTER_AIRPORT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_COMMUTER_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Large airports. */
|
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_LARGE_AIRPORTS_PANEL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_LARGE_AIRPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_LARGE_AIRPORTS, STR_NULL),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
|
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_CITY_AIRPORT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_CITY_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_METRO_AIRPORT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_METRO_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Hub airports. */
|
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_HUB_AIRPORTS_PANEL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_HUB_AIRPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_HUB_AIRPORTS, STR_NULL),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_INTERNATIONAL_AIRPORT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_INTERNATIONAL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_INTERCONTINENTAL_AIRPORT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_INTERCONTINENTAL_AIRPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Heliports. */
|
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_HELIPORTS_PANEL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_HELIPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_HELIPORTS, STR_NULL),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELIPORT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_HELIPORT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELISTATION), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_HELISTATION, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELIDEPOT), SetMinimalSize(144, 12),
|
2009-04-21 23:40:56 +00:00
|
|
|
SetDataTip(STR_HELIDEPOT, STR_STATION_BUILD_AIRPORT_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
/* Bottom panel. */
|
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_BOTTOMPANEL),
|
2009-04-21 23:40:56 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_COVERAGE_LABEL), SetMinimalSize(148, 14), 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-04-21 23:40:56 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
2009-03-22 21:16:57 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(14, 0),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 37),
|
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2009-03-15 15:12:06 +00:00
|
|
|
static const WindowDesc _build_airport_desc(
|
2009-03-22 13:17:37 +00:00
|
|
|
WDP_AUTO, WDP_AUTO, 148, 245, 148, 245,
|
2006-11-10 19:24:14 +00:00
|
|
|
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
2009-02-04 16:59:41 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
|
2009-03-22 21:16:57 +00:00
|
|
|
_build_airport_picker_widgets, _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;
|
|
|
|
}
|