author | rubidium |
Wed, 19 Dec 2007 20:45:46 +0000 | |
changeset 8107 | bb7deea89175 |
parent 8106 | e6790dd9e750 |
child 8116 | 8da76dcb3287 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6117
6507b2a7e71d
(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:
6042
diff
changeset
|
3 |
/** @file airport_gui.cpp */ |
6507b2a7e71d
(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:
6042
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1784
diff
changeset
|
6 |
#include "openttd.h" |
1363
775a7ee52369
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1313
diff
changeset
|
7 |
#include "table/sprites.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
337
diff
changeset
|
8 |
#include "table/strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
1977
diff
changeset
|
9 |
#include "functions.h" |
679
04ca2cd69420
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
606
diff
changeset
|
10 |
#include "map.h" |
8107
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
11 |
#include "window_gui.h" |
0 | 12 |
#include "gui.h" |
8107
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
13 |
#include "station_gui.h" |
0 | 14 |
#include "viewport.h" |
15 |
#include "gfx.h" |
|
337
cbe0c766c947
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
193
diff
changeset
|
16 |
#include "sound.h" |
0 | 17 |
#include "command.h" |
18 |
#include "vehicle.h" |
|
19 |
#include "station.h" |
|
20 |
#include "airport.h" |
|
1313
f1013ec3d318
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1116
diff
changeset
|
21 |
#include "depot.h" |
0 | 22 |
|
23 |
static byte _selected_airport_type; |
|
24 |
||
6247 | 25 |
static void ShowBuildAirportPicker(); |
0 | 26 |
|
27 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
28 |
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 29 |
{ |
30 |
if (success) { |
|
541 | 31 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 32 |
ResetObjectToPlace(); |
33 |
} |
|
34 |
} |
|
35 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
36 |
static void PlaceAirport(TileIndex tile) |
0 | 37 |
{ |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
38 |
DoCommandP(tile, _selected_airport_type, _ctrl_pressed, CcBuildAirport, CMD_BUILD_AIRPORT | CMD_NO_WATER | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE)); |
0 | 39 |
} |
40 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
41 |
static void PlaceAir_DemolishArea(TileIndex tile) |
0 | 42 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
43 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA); |
0 | 44 |
} |
45 |
||
46 |
||
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
47 |
enum { |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
48 |
ATW_AIRPORT = 3, |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
49 |
ATW_DEMOLISH = 4 |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
50 |
}; |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
51 |
|
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
52 |
|
0 | 53 |
static void BuildAirClick_Airport(Window *w) |
54 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7521
diff
changeset
|
55 |
if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, VHM_RECT, PlaceAirport)) ShowBuildAirportPicker(); |
0 | 56 |
} |
57 |
||
58 |
static void BuildAirClick_Demolish(Window *w) |
|
59 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7521
diff
changeset
|
60 |
HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceAir_DemolishArea); |
0 | 61 |
} |
62 |
||
63 |
||
64 |
typedef void OnButtonClick(Window *w); |
|
65 |
static OnButtonClick * const _build_air_button_proc[] = { |
|
66 |
BuildAirClick_Airport, |
|
67 |
BuildAirClick_Demolish, |
|
68 |
}; |
|
69 |
||
70 |
static void BuildAirToolbWndProc(Window *w, WindowEvent *e) |
|
71 |
{ |
|
2639 | 72 |
switch (e->event) { |
0 | 73 |
case WE_PAINT: |
74 |
DrawWindowWidgets(w); |
|
75 |
break; |
|
76 |
||
77 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
78 |
if (e->we.click.widget - 3 >= 0) |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
79 |
_build_air_button_proc[e->we.click.widget - 3](w); |
0 | 80 |
break; |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
946
diff
changeset
|
81 |
|
937
883afa491049
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
82 |
case WE_KEYPRESS: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
83 |
switch (e->we.keypress.keycode) { |
937
883afa491049
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
84 |
case '1': BuildAirClick_Airport(w); break; |
883afa491049
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
85 |
case '2': BuildAirClick_Demolish(w); break; |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
86 |
default: return; |
937
883afa491049
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
87 |
} |
883afa491049
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
88 |
} break; |
0 | 89 |
|
90 |
case WE_PLACE_OBJ: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
91 |
_place_proc(e->we.place.tile); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
92 |
break; |
0 | 93 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4059
diff
changeset
|
94 |
case WE_PLACE_DRAG: |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6491
diff
changeset
|
95 |
VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4059
diff
changeset
|
96 |
break; |
0 | 97 |
|
98 |
case WE_PLACE_MOUSEUP: |
|
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
99 |
if (e->we.place.pt.x != -1 && e->we.place.select_proc == DDSP_DEMOLISH_AREA) { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
100 |
DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
0 | 101 |
} |
102 |
break; |
|
103 |
||
104 |
case WE_ABORT_PLACE_OBJ: |
|
8032
f35fba9bacb0
(svn r11592) -Codechange: Use the Window member RaiseButtons and remove the now useless RaiseWindowButtons function
belugas
parents:
7997
diff
changeset
|
105 |
w->RaiseButtons(); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
106 |
|
0 | 107 |
w = FindWindowById(WC_BUILD_STATION, 0); |
108 |
if (w != 0) |
|
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6247
diff
changeset
|
109 |
WP(w, def_d).close = true; |
0 | 110 |
break; |
2619
1b20d578a660
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
111 |
|
1b20d578a660
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
112 |
case WE_DESTROY: |
1b20d578a660
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
113 |
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
1b20d578a660
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
114 |
break; |
0 | 115 |
} |
116 |
} |
|
117 |
||
118 |
static const Widget _air_toolbar_widgets[] = { |
|
4344
7e123fec5b0b
(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
|
119 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
5682
f109e2e62af8
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5587
diff
changeset
|
120 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 51, 0, 13, STR_A000_AIRPORTS, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
f109e2e62af8
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5587
diff
changeset
|
121 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 52, 63, 0, 13, 0x0, STR_STICKY_BUTTON }, |
4937
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
122 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 41, 14, 35, SPR_IMG_AIRPORT, STR_A01E_BUILD_AIRPORT }, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
123 |
{ 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
|
124 |
{ WIDGETS_END}, |
0 | 125 |
}; |
126 |
||
127 |
||
128 |
static const WindowDesc _air_toolbar_desc = { |
|
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7241
diff
changeset
|
129 |
WDP_ALIGN_TBR, 22, 64, 36, 64, 36, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5860
diff
changeset
|
130 |
WC_BUILD_TOOLBAR, WC_NONE, |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
751
diff
changeset
|
131 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 132 |
_air_toolbar_widgets, |
133 |
BuildAirToolbWndProc |
|
134 |
}; |
|
135 |
||
6247 | 136 |
void ShowBuildAirToolbar() |
0 | 137 |
{ |
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4968
diff
changeset
|
138 |
if (!IsValidPlayer(_current_player)) return; |
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4968
diff
changeset
|
139 |
|
0 | 140 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
5860 | 141 |
Window *w = AllocateWindowDescFront(&_air_toolbar_desc, 0); |
142 |
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); |
|
0 | 143 |
} |
144 |
||
145 |
static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) |
|
146 |
{ |
|
1784
d0698aac0c2e
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1363
diff
changeset
|
147 |
switch (e->event) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
148 |
case WE_CREATE: |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
149 |
w->SetWidgetLoweredState(16, !_station_show_coverage); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
150 |
w->SetWidgetLoweredState(17, _station_show_coverage); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
151 |
w->LowerWidget(_selected_airport_type + 7); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
152 |
break; |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
153 |
|
0 | 154 |
case WE_PAINT: { |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
155 |
int i; // airport enabling loop |
1784
d0698aac0c2e
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1363
diff
changeset
|
156 |
uint32 avail_airports; |
4171 | 157 |
const AirportFTAClass *airport; |
0 | 158 |
|
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6247
diff
changeset
|
159 |
if (WP(w, def_d).close) return; |
0 | 160 |
|
1784
d0698aac0c2e
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1363
diff
changeset
|
161 |
avail_airports = GetValidAirports(); |
d0698aac0c2e
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1363
diff
changeset
|
162 |
|
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
163 |
w->RaiseWidget(_selected_airport_type + 7); |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
164 |
if (!HasBit(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE; |
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
165 |
if (!HasBit(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL; |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
166 |
w->LowerWidget(_selected_airport_type + 7); |
1784
d0698aac0c2e
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1363
diff
changeset
|
167 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
168 |
/* 'Country Airport' starts at widget 7, and if its bit is set, it is |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
169 |
* available, so take its opposite value to set the disabled state. |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
170 |
* There are 9 buildable airports |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
171 |
* XXX TODO : all airports should be held in arrays, with all relevant data. |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
172 |
* This should be part of newgrf-airports, i suppose |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
173 |
*/ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
174 |
for (i = 0; i < 9; i++) w->SetWidgetDisabledState(i + 7, !HasBit(avail_airports, i)); |
1784
d0698aac0c2e
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1363
diff
changeset
|
175 |
|
4059
b1e1c1193f0a
(svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents:
3884
diff
changeset
|
176 |
// select default the coverage area to 'Off' (16) |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
177 |
airport = GetAirport(_selected_airport_type); |
3876
468642825a10
(svn r4918) Move the information about the size of airports from an global array into the struct which describes an airport
tron
parents:
2725
diff
changeset
|
178 |
SetTileSelectSize(airport->size_x, airport->size_y); |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
179 |
|
6042
4e7e4d618cae
(svn r8768) -Fix (r8767): VC8 compilation failed 'warning C4146: unary minus operator applied to unsigned type, result still unsigned'
KUDr
parents:
6041
diff
changeset
|
180 |
int rad = _patches.modified_catchment ? airport->catchment : 4; |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
792
diff
changeset
|
181 |
|
2639 | 182 |
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
0 | 183 |
|
184 |
DrawWindowWidgets(w); |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4059
diff
changeset
|
185 |
// strings such as 'Size' and 'Coverage Area' |
4345
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
186 |
// 'Coverage Area' |
7241
7fd23b6f6713
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
6674
diff
changeset
|
187 |
DrawStationCoverageAreaText(2, 206, SCT_ALL, rad); |
0 | 188 |
break; |
189 |
} |
|
190 |
||
191 |
case WE_CLICK: { |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
192 |
switch (e->we.click.widget) { |
4059
b1e1c1193f0a
(svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents:
3884
diff
changeset
|
193 |
case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
194 |
w->RaiseWidget(_selected_airport_type + 7); |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
195 |
_selected_airport_type = e->we.click.widget - 7; |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
196 |
w->LowerWidget(_selected_airport_type + 7); |
541 | 197 |
SndPlayFx(SND_15_BEEP); |
0 | 198 |
SetWindowDirty(w); |
199 |
break; |
|
4059
b1e1c1193f0a
(svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents:
3884
diff
changeset
|
200 |
case 16: case 17: |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
201 |
_station_show_coverage = (e->we.click.widget != 16); |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
202 |
w->SetWidgetLoweredState(16, !_station_show_coverage); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7928
diff
changeset
|
203 |
w->SetWidgetLoweredState(17, _station_show_coverage); |
541 | 204 |
SndPlayFx(SND_15_BEEP); |
0 | 205 |
SetWindowDirty(w); |
206 |
break; |
|
207 |
} |
|
208 |
} break; |
|
209 |
||
210 |
case WE_MOUSELOOP: { |
|
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6247
diff
changeset
|
211 |
if (WP(w, def_d).close) { |
0 | 212 |
DeleteWindow(w); |
213 |
return; |
|
214 |
} |
|
215 |
||
216 |
CheckRedrawStationCoverage(w); |
|
217 |
} break; |
|
1109
ecb98f43ba2c
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
218 |
|
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1019
diff
changeset
|
219 |
case WE_DESTROY: |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6247
diff
changeset
|
220 |
if (!WP(w, def_d).close) ResetObjectToPlace(); |
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1019
diff
changeset
|
221 |
break; |
0 | 222 |
} |
223 |
} |
|
224 |
||
225 |
static const Widget _build_airport_picker_widgets[] = { |
|
4345
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
226 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
227 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
228 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 52, 0x0, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
229 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 53, 89, 0x0, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
230 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 90, 127, 0x0, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
231 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 128, 177, 0x0, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
232 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 178, 239, 0x0, STR_NULL}, |
4968
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
233 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 27, 38, STR_SMALL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
234 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 65, 76, STR_CITY_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
235 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 141, 152, STR_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
236 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 77, 88, STR_METRO_AIRPORT , STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
237 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 103, 114, STR_INTERNATIONAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
238 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 39, 50, STR_COMMUTER_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
239 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 165, 176, STR_HELIDEPOT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
240 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 115, 126, STR_INTERCONTINENTAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
59dcd41ce2d0
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
241 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 153, 164, STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
4345
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
242 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 191, 202, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
243 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 191, 202, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
244 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 14, 27, STR_SMALL_AIRPORTS, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
245 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 52, 65, STR_LARGE_AIRPORTS, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
246 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 90, 103, STR_HUB_AIRPORTS, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
247 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 128, 141, STR_HELIPORTS, STR_NULL}, |
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
248 |
{ 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
|
249 |
{ WIDGETS_END}, |
0 | 250 |
}; |
251 |
||
252 |
static const WindowDesc _build_airport_desc = { |
|
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7241
diff
changeset
|
253 |
WDP_AUTO, WDP_AUTO, 148, 240, 148, 240, |
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5005
diff
changeset
|
254 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
0 | 255 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
256 |
_build_airport_picker_widgets, |
|
257 |
BuildAirportPickerWndProc |
|
258 |
}; |
|
259 |
||
6247 | 260 |
static void ShowBuildAirportPicker() |
0 | 261 |
{ |
262 |
AllocateWindowDesc(&_build_airport_desc); |
|
263 |
} |
|
264 |
||
6247 | 265 |
void InitializeAirportGui() |
0 | 266 |
{ |
267 |
_selected_airport_type = AT_SMALL; |
|
268 |
} |