author | truebrain |
Fri, 18 Jul 2008 10:15:16 +0000 | |
branch | noai |
changeset 11168 | 3842648184cd |
parent 10776 | 07203fc29812 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10249
diff
changeset
|
3 |
/** @file airport_gui.cpp The GUI for airports. */ |
6443
b8f06d8eb7be
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6368
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1784
diff
changeset
|
6 |
#include "openttd.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
7 |
#include "window_gui.h" |
0 | 8 |
#include "gui.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
9 |
#include "station_gui.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
10 |
#include "terraform_gui.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
11 |
#include "command_func.h" |
0 | 12 |
#include "airport.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
13 |
#include "sound_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
14 |
#include "window_func.h" |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
15 |
#include "strings_func.h" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
16 |
#include "settings_type.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
17 |
#include "viewport_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
18 |
#include "gfx_func.h" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
19 |
#include "player_func.h" |
9837
c9ec4f82e0d0
(svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
9732
diff
changeset
|
20 |
#include "order_func.h" |
10249
58810805030e
(svn r12781) [NoAI] -Sync: with trunk r12711:12780.
rubidium
parents:
10181
diff
changeset
|
21 |
#include "station_type.h" |
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10249
diff
changeset
|
22 |
#include "tilehighlight_func.h" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
23 |
|
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
24 |
#include "table/sprites.h" |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
25 |
#include "table/strings.h" |
0 | 26 |
|
27 |
static byte _selected_airport_type; |
|
28 |
||
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
29 |
static void ShowBuildAirportPicker(Window *parent); |
0 | 30 |
|
31 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
32 |
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 33 |
{ |
34 |
if (success) { |
|
541 | 35 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 36 |
ResetObjectToPlace(); |
37 |
} |
|
38 |
} |
|
39 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
40 |
static void PlaceAirport(TileIndex tile) |
0 | 41 |
{ |
9703
d2a6acdbd665
(svn r11146) [NoAI] -Sync: with trunk r11035:11045.
rubidium
parents:
9694
diff
changeset
|
42 |
DoCommandP(tile, _selected_airport_type, _ctrl_pressed, CcBuildAirport, CMD_BUILD_AIRPORT | CMD_NO_WATER | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE)); |
0 | 43 |
} |
44 |
||
45 |
||
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
46 |
enum { |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
47 |
ATW_AIRPORT = 3, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
48 |
ATW_DEMOLISH = 4 |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
49 |
}; |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
50 |
|
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
51 |
|
0 | 52 |
static void BuildAirClick_Airport(Window *w) |
53 |
{ |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
54 |
if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, VHM_RECT, PlaceAirport)) ShowBuildAirportPicker(w); |
0 | 55 |
} |
56 |
||
57 |
static void BuildAirClick_Demolish(Window *w) |
|
58 |
{ |
|
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10249
diff
changeset
|
59 |
HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); |
0 | 60 |
} |
61 |
||
62 |
||
63 |
typedef void OnButtonClick(Window *w); |
|
64 |
static OnButtonClick * const _build_air_button_proc[] = { |
|
65 |
BuildAirClick_Airport, |
|
66 |
BuildAirClick_Demolish, |
|
67 |
}; |
|
68 |
||
10645 | 69 |
struct BuildAirToolbarWindow : Window { |
70 |
BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
|
71 |
{ |
|
72 |
this->FindWindowPlacementAndResize(desc); |
|
10776 | 73 |
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); |
10645 | 74 |
} |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
75 |
|
10645 | 76 |
~BuildAirToolbarWindow() |
77 |
{ |
|
10776 | 78 |
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
10645 | 79 |
} |
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9869
diff
changeset
|
80 |
|
10645 | 81 |
virtual void OnPaint() |
82 |
{ |
|
83 |
this->DrawWidgets(); |
|
84 |
} |
|
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9869
diff
changeset
|
85 |
|
10645 | 86 |
virtual void OnClick(Point pt, int widget) |
87 |
{ |
|
88 |
if (widget - 3 >= 0) { |
|
89 |
_build_air_button_proc[widget - 3](this); |
|
90 |
} |
|
91 |
} |
|
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9869
diff
changeset
|
92 |
|
10645 | 93 |
|
94 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
|
95 |
{ |
|
96 |
switch (keycode) { |
|
97 |
case '1': BuildAirClick_Airport(this); break; |
|
98 |
case '2': BuildAirClick_Demolish(this); break; |
|
99 |
default: return ES_NOT_HANDLED; |
|
100 |
} |
|
101 |
return ES_HANDLED; |
|
0 | 102 |
} |
10645 | 103 |
|
104 |
virtual void OnPlaceObject(Point pt, TileIndex tile) |
|
105 |
{ |
|
106 |
_place_proc(tile); |
|
107 |
} |
|
108 |
||
109 |
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) |
|
110 |
{ |
|
111 |
VpSelectTilesWithMethod(pt.x, pt.y, select_method); |
|
112 |
} |
|
113 |
||
114 |
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) |
|
115 |
{ |
|
116 |
if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) { |
|
117 |
GUIPlaceProcDragXY(select_proc, start_tile, end_tile); |
|
118 |
} |
|
119 |
} |
|
120 |
||
121 |
virtual void OnPlaceObjectAbort() |
|
122 |
{ |
|
123 |
this->RaiseButtons(); |
|
124 |
||
125 |
delete FindWindowById(WC_BUILD_STATION, 0); |
|
126 |
} |
|
127 |
}; |
|
0 | 128 |
|
129 |
static const Widget _air_toolbar_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
130 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
5933
0835f3342b79
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5838
diff
changeset
|
131 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 51, 0, 13, STR_A000_AIRPORTS, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
0835f3342b79
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5838
diff
changeset
|
132 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 52, 63, 0, 13, 0x0, STR_STICKY_BUTTON }, |
4937
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
133 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 41, 14, 35, SPR_IMG_AIRPORT, STR_A01E_BUILD_AIRPORT }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
134 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 42, 63, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC }, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
0
diff
changeset
|
135 |
{ WIDGETS_END}, |
0 | 136 |
}; |
137 |
||
138 |
||
139 |
static const WindowDesc _air_toolbar_desc = { |
|
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9641
diff
changeset
|
140 |
WDP_ALIGN_TBR, 22, 64, 36, 64, 36, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6111
diff
changeset
|
141 |
WC_BUILD_TOOLBAR, WC_NONE, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
751
diff
changeset
|
142 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 143 |
_air_toolbar_widgets, |
144 |
}; |
|
145 |
||
6573 | 146 |
void ShowBuildAirToolbar() |
0 | 147 |
{ |
5005
21e84e53c732
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4968
diff
changeset
|
148 |
if (!IsValidPlayer(_current_player)) return; |
21e84e53c732
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4968
diff
changeset
|
149 |
|
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10249
diff
changeset
|
150 |
DeleteWindowByClass(WC_BUILD_TOOLBAR); |
10645 | 151 |
AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR); |
0 | 152 |
} |
153 |
||
10645 | 154 |
class AirportPickerWindow : public PickerWindowBase { |
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9869
diff
changeset
|
155 |
|
10645 | 156 |
enum { |
157 |
BAW_BOTTOMPANEL = 10, |
|
158 |
BAW_SMALL_AIRPORT, |
|
159 |
BAW_CITY_AIRPORT, |
|
160 |
BAW_HELIPORT, |
|
161 |
BAW_METRO_AIRPORT, |
|
162 |
BAW_STR_INTERNATIONAL_AIRPORT, |
|
163 |
BAW_COMMUTER_AIRPORT, |
|
164 |
BAW_HELIDEPOT, |
|
165 |
BAW_STR_INTERCONTINENTAL_AIRPORT, |
|
166 |
BAW_HELISTATION, |
|
167 |
BAW_LAST_AIRPORT = BAW_HELISTATION, |
|
168 |
BAW_AIRPORT_COUNT = BAW_LAST_AIRPORT - BAW_SMALL_AIRPORT + 1, |
|
169 |
BAW_BTN_DONTHILIGHT = BAW_LAST_AIRPORT + 1, |
|
170 |
BAW_BTN_DOHILIGHT, |
|
171 |
}; |
|
0 | 172 |
|
10645 | 173 |
public: |
0 | 174 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
175 |
AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) |
10645 | 176 |
{ |
177 |
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage); |
|
178 |
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); |
|
179 |
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
|
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
180 |
|
10776 | 181 |
if (_settings_game.economy.station_noise_level) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
182 |
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, 10); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
183 |
} |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
184 |
|
10645 | 185 |
this->FindWindowPlacementAndResize(desc); |
186 |
} |
|
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9869
diff
changeset
|
187 |
|
10645 | 188 |
virtual void OnPaint() |
189 |
{ |
|
190 |
int i; // airport enabling loop |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
191 |
uint16 y_noise_offset = 0; |
10645 | 192 |
uint32 avail_airports; |
193 |
const AirportFTAClass *airport; |
|
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9869
diff
changeset
|
194 |
|
10645 | 195 |
avail_airports = GetValidAirports(); |
196 |
||
197 |
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
|
198 |
if (!HasBit(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE; |
|
199 |
if (!HasBit(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL; |
|
200 |
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
|
201 |
||
202 |
/* 'Country Airport' starts at widget BAW_SMALL_AIRPORT, and if its bit is set, it is |
|
203 |
* available, so take its opposite value to set the disabled state. |
|
204 |
* There are 9 buildable airports |
|
205 |
* XXX TODO : all airports should be held in arrays, with all relevant data. |
|
206 |
* This should be part of newgrf-airports, i suppose |
|
207 |
*/ |
|
208 |
for (i = 0; i < BAW_AIRPORT_COUNT; i++) this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !HasBit(avail_airports, i)); |
|
209 |
||
210 |
/* select default the coverage area to 'Off' (16) */ |
|
211 |
airport = GetAirport(_selected_airport_type); |
|
212 |
SetTileSelectSize(airport->size_x, airport->size_y); |
|
213 |
||
10776 | 214 |
int rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED; |
10645 | 215 |
|
216 |
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
|
217 |
||
218 |
this->DrawWidgets(); |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
219 |
|
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
220 |
/* only show the station (airport) noise, if the noise option is activated */ |
10776 | 221 |
if (_settings_game.economy.station_noise_level) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
222 |
/* show the noise of the selected airport */ |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
223 |
SetDParam(0, airport->noise_level); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
224 |
DrawString(2, 206, STR_STATION_NOISE, 0); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
225 |
y_noise_offset = 10; |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
226 |
} |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
227 |
|
10645 | 228 |
/* strings such as 'Size' and 'Coverage Area' */ |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
229 |
int text_end = DrawStationCoverageAreaText(2, this->widget[BAW_BTN_DOHILIGHT].bottom + 4 + y_noise_offset, SCT_ALL, rad, false); |
10645 | 230 |
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; |
231 |
if (text_end != this->widget[BAW_BOTTOMPANEL].bottom) { |
|
232 |
this->SetDirty(); |
|
233 |
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, text_end - this->widget[BAW_BOTTOMPANEL].bottom); |
|
234 |
this->SetDirty(); |
|
235 |
} |
|
0 | 236 |
} |
10645 | 237 |
|
238 |
virtual void OnClick(Point pt, int widget) |
|
239 |
{ |
|
240 |
switch (widget) { |
|
241 |
case BAW_SMALL_AIRPORT: case BAW_CITY_AIRPORT: case BAW_HELIPORT: case BAW_METRO_AIRPORT: |
|
242 |
case BAW_STR_INTERNATIONAL_AIRPORT: case BAW_COMMUTER_AIRPORT: case BAW_HELIDEPOT: |
|
243 |
case BAW_STR_INTERCONTINENTAL_AIRPORT: case BAW_HELISTATION: |
|
244 |
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
|
245 |
_selected_airport_type = widget - BAW_SMALL_AIRPORT; |
|
246 |
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
|
247 |
SndPlayFx(SND_15_BEEP); |
|
248 |
this->SetDirty(); |
|
249 |
break; |
|
250 |
||
251 |
case BAW_BTN_DONTHILIGHT: case BAW_BTN_DOHILIGHT: |
|
252 |
_station_show_coverage = (widget != BAW_BTN_DONTHILIGHT); |
|
253 |
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage); |
|
254 |
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); |
|
255 |
SndPlayFx(SND_15_BEEP); |
|
256 |
this->SetDirty(); |
|
257 |
break; |
|
258 |
} |
|
259 |
} |
|
260 |
||
261 |
virtual void OnTick() |
|
262 |
{ |
|
263 |
CheckRedrawStationCoverage(this); |
|
264 |
} |
|
265 |
}; |
|
0 | 266 |
|
267 |
static const Widget _build_airport_picker_widgets[] = { |
|
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
268 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
269 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
270 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 52, 0x0, STR_NULL}, |
10181
54df587fef5d
(svn r12712) [NoAI] -Sync with trunk r12672:12711.
rubidium
parents:
10142
diff
changeset
|
271 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 14, 27, STR_SMALL_AIRPORTS, STR_NULL}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
272 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 53, 89, 0x0, STR_NULL}, |
10181
54df587fef5d
(svn r12712) [NoAI] -Sync with trunk r12672:12711.
rubidium
parents:
10142
diff
changeset
|
273 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 52, 65, STR_LARGE_AIRPORTS, STR_NULL}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
274 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 90, 127, 0x0, STR_NULL}, |
10181
54df587fef5d
(svn r12712) [NoAI] -Sync with trunk r12672:12711.
rubidium
parents:
10142
diff
changeset
|
275 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 90, 103, STR_HUB_AIRPORTS, STR_NULL}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
276 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 128, 177, 0x0, STR_NULL}, |
10181
54df587fef5d
(svn r12712) [NoAI] -Sync with trunk r12672:12711.
rubidium
parents:
10142
diff
changeset
|
277 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 128, 141, STR_HELIPORTS, STR_NULL}, |
54df587fef5d
(svn r12712) [NoAI] -Sync with trunk r12672:12711.
rubidium
parents:
10142
diff
changeset
|
278 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 178, 239, 0x0, STR_NULL}, // bottom general box |
4968
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
279 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 27, 38, STR_SMALL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
280 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 65, 76, STR_CITY_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
281 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 141, 152, STR_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
282 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 77, 88, STR_METRO_AIRPORT , STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
283 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 103, 114, STR_INTERNATIONAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
284 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 39, 50, STR_COMMUTER_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
285 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 165, 176, STR_HELIDEPOT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
286 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 115, 126, STR_INTERCONTINENTAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
287 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 153, 164, STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
288 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 191, 202, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
289 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 191, 202, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
290 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 178, 191, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
0
diff
changeset
|
291 |
{ WIDGETS_END}, |
0 | 292 |
}; |
293 |
||
294 |
static const WindowDesc _build_airport_desc = { |
|
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9641
diff
changeset
|
295 |
WDP_AUTO, WDP_AUTO, 148, 240, 148, 240, |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5005
diff
changeset
|
296 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
0 | 297 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
298 |
_build_airport_picker_widgets, |
|
299 |
}; |
|
300 |
||
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
301 |
static void ShowBuildAirportPicker(Window *parent) |
0 | 302 |
{ |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
303 |
new AirportPickerWindow(&_build_airport_desc, parent); |
0 | 304 |
} |
305 |
||
6573 | 306 |
void InitializeAirportGui() |
0 | 307 |
{ |
308 |
_selected_airport_type = AT_SMALL; |
|
309 |
} |