author | rubidium |
Sat, 06 Oct 2007 21:16:00 +0000 | |
branch | NewGRF_ports |
changeset 6870 | ca3fd1fbe311 |
parent 6814 | 69417b3657f1 |
child 6871 | 5a9dc001e1ad |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
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
|
3 |
/** @file airport_gui.cpp */ |
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" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1313
diff
changeset
|
7 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
337
diff
changeset
|
8 |
#include "table/strings.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
1977
diff
changeset
|
9 |
#include "functions.h" |
679
e959706a3e4d
(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" |
0 | 11 |
#include "window.h" |
12 |
#include "gui.h" |
|
13 |
#include "viewport.h" |
|
14 |
#include "gfx.h" |
|
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
193
diff
changeset
|
15 |
#include "sound.h" |
0 | 16 |
#include "command.h" |
17 |
#include "vehicle.h" |
|
18 |
#include "station.h" |
|
19 |
#include "airport.h" |
|
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1116
diff
changeset
|
20 |
#include "depot.h" |
6726
fc44af727904
(svn r10596) [NewGRF_ports] -Fix: missed move of SetDParam into strings.h.
richk
parents:
6724
diff
changeset
|
21 |
#include "strings.h" |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
22 |
#include "newgrf_callbacks.h" |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
23 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
24 |
//TODO: remove station.h once converted to newgrf airports. stations just used as temporary loader |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
25 |
#include "station.h" |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
26 |
|
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
27 |
static struct { |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
28 |
byte layout_set; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
29 |
byte numtracks; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
30 |
byte platlength; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
31 |
bool dragdrop; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
32 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
33 |
FSMportsClassIDByte fsmports_class; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
34 |
byte station_type; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
35 |
byte station_count; |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
36 |
DirectionByte direction; |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
37 |
} _airport; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
38 |
|
6573 | 39 |
static void ShowBuildAirportPicker(); |
0 | 40 |
|
41 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
42 |
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 43 |
{ |
44 |
if (success) { |
|
541 | 45 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 46 |
ResetObjectToPlace(); |
47 |
} |
|
48 |
} |
|
49 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
50 |
static void PlaceAirport(TileIndex tile) |
0 | 51 |
{ |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
52 |
if (_airport.station_type != 0xFF) /*0xFF represents No Airports Available to build */ |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
53 |
DoCommandP(tile, |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
54 |
_airport.layout_set | (_airport.numtracks << 8) | (_airport.platlength << 16) | (_ctrl_pressed << 24), |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
55 |
0x80 | (_airport.fsmports_class << 8) | (_airport.station_type << 16), CcBuildAirport, |
6870
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6814
diff
changeset
|
56 |
CMD_BUILD_AIRPORT | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE)); |
0 | 57 |
} |
58 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
59 |
static void PlaceAir_DemolishArea(TileIndex tile) |
0 | 60 |
{ |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6718
diff
changeset
|
61 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA); |
0 | 62 |
} |
63 |
||
64 |
||
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
65 |
enum { |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
66 |
ATW_AIRPORT = 3, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
67 |
ATW_DEMOLISH = 4 |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
68 |
}; |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
69 |
|
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
70 |
|
0 | 71 |
static void BuildAirClick_Airport(Window *w) |
72 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
73 |
if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, 1, PlaceAirport)) ShowBuildAirportPicker(); |
0 | 74 |
} |
75 |
||
76 |
static void BuildAirClick_Demolish(Window *w) |
|
77 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
78 |
HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, 1, PlaceAir_DemolishArea); |
0 | 79 |
} |
80 |
||
81 |
||
82 |
typedef void OnButtonClick(Window *w); |
|
83 |
static OnButtonClick * const _build_air_button_proc[] = { |
|
84 |
BuildAirClick_Airport, |
|
85 |
BuildAirClick_Demolish, |
|
86 |
}; |
|
87 |
||
88 |
static void BuildAirToolbWndProc(Window *w, WindowEvent *e) |
|
89 |
{ |
|
2639 | 90 |
switch (e->event) { |
0 | 91 |
case WE_PAINT: |
92 |
DrawWindowWidgets(w); |
|
93 |
break; |
|
94 |
||
95 |
case WE_CLICK: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
96 |
if (e->we.click.widget - 3 >= 0) |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
97 |
_build_air_button_proc[e->we.click.widget - 3](w); |
0 | 98 |
break; |
1019
6363b8a4273e
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
946
diff
changeset
|
99 |
|
937
a8dfd3eb406f
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
100 |
case WE_KEYPRESS: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
101 |
switch (e->we.keypress.keycode) { |
937
a8dfd3eb406f
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
102 |
case '1': BuildAirClick_Airport(w); break; |
a8dfd3eb406f
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
103 |
case '2': BuildAirClick_Demolish(w); break; |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
104 |
default: return; |
937
a8dfd3eb406f
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
105 |
} |
a8dfd3eb406f
(svn r1425) Added hotkeys for dock and airport toolbar
celestar
parents:
867
diff
changeset
|
106 |
} break; |
0 | 107 |
|
108 |
case WE_PLACE_OBJ: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
109 |
_place_proc(e->we.place.tile); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
110 |
break; |
0 | 111 |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4059
diff
changeset
|
112 |
case WE_PLACE_DRAG: |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6718
diff
changeset
|
113 |
VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4059
diff
changeset
|
114 |
break; |
0 | 115 |
|
116 |
case WE_PLACE_MOUSEUP: |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6718
diff
changeset
|
117 |
if (e->we.place.pt.x != -1 && e->we.place.select_proc == DDSP_DEMOLISH_AREA) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
118 |
DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
0 | 119 |
} |
120 |
break; |
|
121 |
||
122 |
case WE_ABORT_PLACE_OBJ: |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
123 |
RaiseWindowButtons(w); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
124 |
|
0 | 125 |
w = FindWindowById(WC_BUILD_STATION, 0); |
126 |
if (w != 0) |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6718
diff
changeset
|
127 |
WP(w, def_d).close = true; |
0 | 128 |
break; |
2619
c2f488e400b1
(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
|
129 |
|
c2f488e400b1
(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
|
130 |
case WE_DESTROY: |
c2f488e400b1
(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
|
131 |
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
c2f488e400b1
(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
|
132 |
break; |
0 | 133 |
} |
134 |
} |
|
135 |
||
136 |
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
|
137 |
{ 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
|
138 |
{ 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
|
139 |
{ 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
|
140 |
{ 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
|
141 |
{ 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
|
142 |
{ WIDGETS_END}, |
0 | 143 |
}; |
144 |
||
145 |
||
146 |
static const WindowDesc _air_toolbar_desc = { |
|
6743
cabfaa4a0295
(svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents:
6741
diff
changeset
|
147 |
WDP_ALIGN_TBR, 22, 64, 36, 64, 36, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6111
diff
changeset
|
148 |
WC_BUILD_TOOLBAR, WC_NONE, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
751
diff
changeset
|
149 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 150 |
_air_toolbar_widgets, |
151 |
BuildAirToolbWndProc |
|
152 |
}; |
|
153 |
||
6573 | 154 |
void ShowBuildAirToolbar() |
0 | 155 |
{ |
5005
21e84e53c732
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4968
diff
changeset
|
156 |
if (!IsValidPlayer(_current_player)) return; |
21e84e53c732
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4968
diff
changeset
|
157 |
|
0 | 158 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
6111 | 159 |
Window *w = AllocateWindowDescFront(&_air_toolbar_desc, 0); |
160 |
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); |
|
0 | 161 |
} |
162 |
||
163 |
static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) |
|
164 |
{ |
|
1784
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1363
diff
changeset
|
165 |
switch (e->event) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
166 |
case WE_CREATE: |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
167 |
SetWindowWidgetLoweredState(w, 12, !_station_show_coverage); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
168 |
SetWindowWidgetLoweredState(w, 13, _station_show_coverage); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
169 |
break; |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
170 |
|
0 | 171 |
case WE_PAINT: { |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
172 |
byte preview_sprite = 0xFF; |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
173 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
174 |
FSMportsSpec *fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, _airport.station_type); |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
175 |
/* if the port is no longer available, find one that is */ |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
176 |
if ((fsmportspec == NULL) || (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0)) { |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
177 |
/* port not available, find new one*/ |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
178 |
_airport.station_type = 0xFF; //set to the invalid condition to prevent any selection if nothing is available |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
179 |
for (uint i = 0; i < _airport.station_count; i++) { |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
180 |
fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, i); |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
181 |
if (!HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) || GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) != 0) { |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
182 |
_airport.station_type = i; |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
183 |
break; |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
184 |
} |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
185 |
} |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
186 |
} |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
187 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6718
diff
changeset
|
188 |
if (WP(w, def_d).close) return; |
0 | 189 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
190 |
for (byte j = 0; j < 4; j++) { |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
191 |
SetWindowWidgetDisabledState(w, 8 + j, true); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
192 |
RaiseWindowWidget(w, 8 + j); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
193 |
w->widget[8 + j].data = SPR_IMG_ARROW_NE_WHITE + j; //reset arrows to white |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
194 |
} |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
195 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
196 |
if (_airport.station_type != 0xFF) { |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
197 |
int x = fsmportspec->size_x[_airport.layout_set]; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
198 |
int y = fsmportspec->size_y[_airport.layout_set]; |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
199 |
SetTileSelectSize(x, y); |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
200 |
|
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
201 |
/* an airport is available, so read it and update screen accordingly */ |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
202 |
for (byte j = 0; j < fsmportspec->numlayouts; j++) { |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
203 |
if (fsmportspec->layouts[j] == NULL) break; |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
204 |
/* enable the permitted orientations */ |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
205 |
byte *layout_ptr = (byte*)alloca(x*y + 2); |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
206 |
memcpy(layout_ptr, fsmportspec->layouts[j], (x * y) + 2); |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
207 |
SetWindowWidgetDisabledState(w, 8 + GB((byte)*layout_ptr, 1, 2), false); |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
208 |
if (j == _airport.layout_set) { |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
209 |
layout_ptr++; |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
210 |
preview_sprite = *layout_ptr; |
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
211 |
} |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
212 |
} |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
213 |
LowerWindowWidget(w, 8 + DirToDiagDir(_airport.direction)); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
214 |
w->widget[8 + DirToDiagDir(_airport.direction)].data = SPR_IMG_ARROW_NE_YELLOW + DirToDiagDir(_airport.direction); //show in yellow |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
215 |
|
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
216 |
|
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
217 |
} |
0 | 218 |
|
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
219 |
SetDParam(0, GetFSMportsClassName(_airport.fsmports_class)); |
0 | 220 |
DrawWindowWidgets(w); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
221 |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4059
diff
changeset
|
222 |
// strings such as 'Size' and 'Coverage Area' |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
223 |
// 'Coverage Area' |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
224 |
if (_airport.station_type != 0xFF) { |
6776
710f906532ff
(svn r10832) [NewGRF_ports] -Change: If no airports are selectable, then the image of the first in the list is shown, but greyed out.
richk
parents:
6774
diff
changeset
|
225 |
/* draw the preview image if the station is available */ |
6774
058a44ffc7c2
(svn r10830) [NewGRF_ports] -Fix: Only test and draw a preview picture if the fsmportspec can be accessed.
richk
parents:
6770
diff
changeset
|
226 |
if (!HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) || GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) != 0) { |
058a44ffc7c2
(svn r10830) [NewGRF_ports] -Fix: Only test and draw a preview picture if the fsmportspec can be accessed.
richk
parents:
6770
diff
changeset
|
227 |
DrawFSMportsTile(9, 106, preview_sprite, _airport.fsmports_class, _airport.station_type); |
058a44ffc7c2
(svn r10830) [NewGRF_ports] -Fix: Only test and draw a preview picture if the fsmportspec can be accessed.
richk
parents:
6770
diff
changeset
|
228 |
} |
6807
436fc766fc34
(svn r10881) [NewGRF_ports] -Feature: Adds irregular highlight to airport placement based on the FSMportLayout data. You can now see where the holes should be!
richk
parents:
6776
diff
changeset
|
229 |
_thd.FSMportLayout = &fsmportspec->layouts[_airport.layout_set]; // irregular airport support |
6812
35bd847c2aba
(svn r10889) [NewGRF_ports] -Feature: Colour of highlight for FSMs with placement masks shows Green for land tiles, and Blue for water tiles.
richk
parents:
6807
diff
changeset
|
230 |
_thd.FSMportMask = NULL; |
35bd847c2aba
(svn r10889) [NewGRF_ports] -Feature: Colour of highlight for FSMs with placement masks shows Green for land tiles, and Blue for water tiles.
richk
parents:
6807
diff
changeset
|
231 |
if (fsmportspec->layout_mask != NULL) _thd.FSMportMask = &fsmportspec->layout_mask[_airport.layout_set]; // irregular airport support |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
232 |
int rad = _patches.modified_catchment ? fsmportspec->portFSM->catchment : 4; |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
233 |
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
234 |
DrawStationCoverageAreaText(2, 206, SCT_ALL, rad); |
6776
710f906532ff
(svn r10832) [NewGRF_ports] -Change: If no airports are selectable, then the image of the first in the list is shown, but greyed out.
richk
parents:
6774
diff
changeset
|
235 |
} else { |
710f906532ff
(svn r10832) [NewGRF_ports] -Change: If no airports are selectable, then the image of the first in the list is shown, but greyed out.
richk
parents:
6774
diff
changeset
|
236 |
/* if nothing is selectable, draw the image of the first in the non-selectable list, but grey out the preview */ |
6814
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
237 |
fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, 0); |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
238 |
byte *layout_ptr = (byte*)alloca(fsmportspec->size_x[0] * fsmportspec->size_y[0] + 2); |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
239 |
memcpy(layout_ptr, fsmportspec->layouts[0], (fsmportspec->size_x[0] * fsmportspec->size_y[0]) + 2); |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
240 |
layout_ptr++; |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
241 |
preview_sprite = *layout_ptr; |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
242 |
DrawFSMportsTile(9, 106, preview_sprite, _airport.fsmports_class, 0); |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
243 |
GfxFillRect(8, 106, 105, 172, (1 << PALETTE_MODIFIER_GREYOUT)); |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
244 |
_thd.FSMportLayout = NULL; // ensure irregular airport support disabled |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
245 |
_thd.FSMportMask = NULL; |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
246 |
SetTileSelectSize(1,1); |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6757
diff
changeset
|
247 |
} |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
248 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
249 |
for (uint16 i = w->vscroll.pos, y = 35; i < _airport.station_count && i < (uint)(w->vscroll.pos + w->vscroll.cap); i++, y += 14) { |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
250 |
const FSMportsSpec *fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, i); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
251 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
252 |
if (fsmportspec != NULL && fsmportspec->name != 0) { |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
253 |
if (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0) { |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
254 |
GfxFillRect(8, y - 2, 127, y + 10, (1 << PALETTE_MODIFIER_GREYOUT)); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
255 |
} |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
256 |
DrawStringTruncated(9, y, fsmportspec->name, i == _airport.station_type ? 12 : 16, 118); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
257 |
} else { |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
258 |
DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _airport.station_type ? 12 : 16, 118); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
259 |
} |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
260 |
} |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
261 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
262 |
|
0 | 263 |
break; |
264 |
} |
|
265 |
||
266 |
case WE_CLICK: { |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4345
diff
changeset
|
267 |
switch (e->we.click.widget) { |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
268 |
case 12: case 13: |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
269 |
_station_show_coverage = (e->we.click.widget != 12); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
270 |
SetWindowWidgetLoweredState(w, 12, !_station_show_coverage); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
271 |
SetWindowWidgetLoweredState(w, 13, _station_show_coverage); |
541 | 272 |
SndPlayFx(SND_15_BEEP); |
0 | 273 |
SetWindowDirty(w); |
274 |
break; |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
275 |
case 3: |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
276 |
case 4: |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
277 |
ShowDropDownMenu(w, BuildFSMportsClassDropdown(), _airport.fsmports_class, 4, 0, 0); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
278 |
break; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
279 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
280 |
case 5: { |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
281 |
const FSMportsSpec *fsmportspec; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
282 |
int y = (e->we.click.pt.y - 32) / 14; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
283 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
284 |
if (y >= w->vscroll.cap) return; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
285 |
y += w->vscroll.pos; |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
286 |
if (y >= _airport.station_count) return; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
287 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
288 |
/* Check station availability callback */ |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
289 |
fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, y); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
290 |
if (fsmportspec != NULL && |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
291 |
HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
292 |
GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0) return; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
293 |
|
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
294 |
_airport.station_type = y; |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
295 |
_airport.layout_set = 0; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
296 |
_airport.platlength= fsmportspec->size_y[_airport.layout_set]; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
297 |
_airport.numtracks = fsmportspec->size_x[_airport.layout_set]; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
298 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
299 |
SndPlayFx(SND_15_BEEP); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
300 |
SetWindowDirty(w); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
301 |
break; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
302 |
} |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
303 |
case 8: case 9: case 10: case 11: |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
304 |
w->widget[8 + DirToDiagDir(_airport.direction)].data = SPR_IMG_ARROW_NE_WHITE + DirToDiagDir(_airport.direction); //reset arrow to white |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
305 |
|
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
306 |
/* find the layout_set that corresponds to the selected orientation */ |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
307 |
FSMportsSpec *fsmportspec = GetCustomFSMportsSpec(_airport.fsmports_class, _airport.station_type); |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
308 |
_airport.layout_set = 0; |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
309 |
_airport.direction = DiagDirToDir((DiagDirection)(e->we.click.widget - 8)); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
310 |
for (byte j = 0; j < fsmportspec->numlayouts; j++) { |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
311 |
int x = fsmportspec->size_x[j]; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
312 |
int y = fsmportspec->size_y[j]; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
313 |
if (fsmportspec->layouts[j] == NULL) break; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
314 |
/* enable the permitted orientations */ |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
315 |
byte *layout_ptr = (byte*)alloca(x * y + 2); |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
316 |
memcpy(layout_ptr, fsmportspec->layouts[j], (x * y) + 2); |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
317 |
if (*layout_ptr == _airport.direction) { |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
318 |
_airport.layout_set = j; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
319 |
break; |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
320 |
} |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
321 |
} |
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
322 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
323 |
SetWindowWidgetLoweredState(w, 8, (_airport.direction == DIR_NE)); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
324 |
SetWindowWidgetLoweredState(w, 9, (_airport.direction == DIR_SE)); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
325 |
SetWindowWidgetLoweredState(w, 10, (_airport.direction == DIR_SW)); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
326 |
SetWindowWidgetLoweredState(w, 11, (_airport.direction == DIR_NW)); |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
327 |
SndPlayFx(SND_15_BEEP); |
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
328 |
SetWindowDirty(w); |
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
329 |
break; |
0 | 330 |
} |
331 |
} break; |
|
332 |
||
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
333 |
case WE_DROPDOWN_SELECT: { |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
334 |
if (_airport.fsmports_class != e->we.dropdown.index) { |
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
335 |
_airport.fsmports_class = (FSMportsClassID)e->we.dropdown.index; |
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
336 |
_airport.station_type = 0; |
6762
aebd7285dbc2
(svn r10804) [NewGRF_ports] -Fix: Gui failed when layouts were not contiguous. eg. 01 and 07
richk
parents:
6760
diff
changeset
|
337 |
_airport.layout_set = 0; |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
338 |
_airport.direction = DIR_NE; |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
339 |
_airport.station_count = GetNumCustomFSMports(_airport.fsmports_class); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
340 |
|
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
341 |
w->vscroll.count = _airport.station_count; |
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
342 |
w->vscroll.pos = _airport.station_type; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
343 |
} |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
344 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
345 |
SndPlayFx(SND_15_BEEP); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
346 |
SetWindowDirty(w); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
347 |
} break; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
348 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
349 |
|
0 | 350 |
case WE_MOUSELOOP: { |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6718
diff
changeset
|
351 |
if (WP(w, def_d).close) { |
0 | 352 |
DeleteWindow(w); |
353 |
return; |
|
354 |
} |
|
355 |
||
356 |
CheckRedrawStationCoverage(w); |
|
357 |
} break; |
|
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
358 |
|
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1019
diff
changeset
|
359 |
case WE_DESTROY: |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6718
diff
changeset
|
360 |
if (!WP(w, def_d).close) ResetObjectToPlace(); |
6814
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
361 |
_thd.FSMportLayout = NULL; // ensure irregular airport support disabled |
69417b3657f1
(svn r10893) [NewGRF_ports] -Fix: Ensure coloured & masked selections disabled on exit of airport_gui.
richk
parents:
6812
diff
changeset
|
362 |
_thd.FSMportMask = NULL; |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1019
diff
changeset
|
363 |
break; |
0 | 364 |
} |
365 |
} |
|
366 |
||
367 |
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
|
368 |
{ 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
|
369 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
370 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 239, 0x0, STR_NULL}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
371 |
{ WWT_INSET, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
372 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 129, 139, 18, 27, STR_0225, STR_SELECT_STATION_CLASS_TIP}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
373 |
{ WWT_MATRIX, RESIZE_NONE, 14, 7, 128, 32, 102, 0x501, STR_SELECT_STATION_TYPE_TIP}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
374 |
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 129, 140, 32, 102, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
375 |
{ WWT_INSET, RESIZE_NONE, 7, 7, 107, 104, 173, 0x0, STR_NULL}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
376 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 104, 119, SPR_IMG_ARROW_NE_WHITE, STR_NULL}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
377 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 122, 137, SPR_IMG_ARROW_SE_WHITE, STR_NULL}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
378 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 140, 155, SPR_IMG_ARROW_SW_WHITE, STR_NULL}, |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
379 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 109, 140, 158, 173, SPR_IMG_ARROW_NW_WHITE, STR_NULL}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
380 |
{ 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
|
381 |
{ 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
|
382 |
{ 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
|
383 |
{ WIDGETS_END}, |
0 | 384 |
}; |
385 |
||
386 |
static const WindowDesc _build_airport_desc = { |
|
6743
cabfaa4a0295
(svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents:
6741
diff
changeset
|
387 |
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
|
388 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
0 | 389 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
390 |
_build_airport_picker_widgets, |
|
391 |
BuildAirportPickerWndProc |
|
392 |
}; |
|
393 |
||
6573 | 394 |
static void ShowBuildAirportPicker() |
0 | 395 |
{ |
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
396 |
Window *w = AllocateWindowDesc(&_build_airport_desc); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
397 |
if (w == NULL) return; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
6720
diff
changeset
|
398 |
|
6768
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
399 |
_airport.station_type = 0; |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
400 |
_airport.layout_set = 0; |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
401 |
_airport.direction = DIR_NE; |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
402 |
_airport.station_count = GetNumCustomFSMports(_airport.fsmports_class); |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
403 |
//if (HASBIT(fsmportspec->callbackmask, CBM_STATION_AVAIL) && GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) == 0) { |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
404 |
// _airport.station_type = 0; |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
405 |
//} |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
406 |
|
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
407 |
w->vscroll.count = _airport.station_count; |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
408 |
w->vscroll.cap = 5; |
d29ac98e3e0c
(svn r10818) [NewGRF_ports] -Codechange: remove the remnants of the old airports from the GUI.
rubidium
parents:
6765
diff
changeset
|
409 |
w->vscroll.pos = clamp(_airport.station_type - 2, 0, w->vscroll.count - w->vscroll.cap); |
0 | 410 |
} |
411 |
||
6573 | 412 |
void InitializeAirportGui() |
0 | 413 |
{ |
414 |
} |