equal
deleted
inserted
replaced
2 |
2 |
3 /** @file airport_gui.cpp */ |
3 /** @file airport_gui.cpp */ |
4 |
4 |
5 #include "stdafx.h" |
5 #include "stdafx.h" |
6 #include "openttd.h" |
6 #include "openttd.h" |
7 #include "table/sprites.h" |
7 #include "window_gui.h" |
8 #include "table/strings.h" |
|
9 #include "functions.h" |
|
10 #include "map.h" |
|
11 #include "window.h" |
|
12 #include "gui.h" |
8 #include "gui.h" |
13 #include "viewport.h" |
9 #include "station_gui.h" |
14 #include "gfx.h" |
10 #include "terraform_gui.h" |
15 #include "sound.h" |
11 #include "command_func.h" |
16 #include "command.h" |
|
17 #include "vehicle.h" |
|
18 #include "station.h" |
12 #include "station.h" |
19 #include "airport.h" |
13 #include "airport.h" |
20 #include "depot.h" |
14 #include "depot.h" |
21 #include "strings.h" |
|
22 #include "newgrf_callbacks.h" |
15 #include "newgrf_callbacks.h" |
|
16 #include "sound_func.h" |
|
17 #include "window_func.h" |
|
18 #include "settings_type.h" |
|
19 #include "viewport_func.h" |
|
20 #include "gfx_func.h" |
|
21 #include "player_func.h" |
|
22 #include "widgets/dropdown_func.h" |
|
23 #include "strings_func.h" |
23 |
24 |
24 //TODO: remove station.h once converted to newgrf airports. stations just used as temporary loader |
25 //TODO: remove station.h once converted to newgrf airports. stations just used as temporary loader |
25 #include "station.h" |
26 #include "station.h" |
|
27 |
|
28 #include "table/sprites.h" |
|
29 #include "table/strings.h" |
26 |
30 |
27 static struct { |
31 static struct { |
28 byte layout_set; |
32 byte layout_set; |
29 byte numtracks; |
33 byte numtracks; |
30 byte platlength; |
34 byte platlength; |
118 DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
122 DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
119 } |
123 } |
120 break; |
124 break; |
121 |
125 |
122 case WE_ABORT_PLACE_OBJ: |
126 case WE_ABORT_PLACE_OBJ: |
123 RaiseWindowButtons(w); |
127 w->RaiseButtons(); |
124 |
128 |
125 w = FindWindowById(WC_BUILD_STATION, 0); |
129 w = FindWindowById(WC_BUILD_STATION, 0); |
126 if (w != 0) |
130 if (w != 0) |
127 WP(w, def_d).close = true; |
131 WP(w, def_d).close = true; |
128 break; |
132 break; |
186 } |
190 } |
187 |
191 |
188 if (WP(w, def_d).close) return; |
192 if (WP(w, def_d).close) return; |
189 |
193 |
190 for (byte j = 0; j < 4; j++) { |
194 for (byte j = 0; j < 4; j++) { |
191 SetWindowWidgetDisabledState(w, 8 + j, true); |
195 w->SetWidgetDisabledState(8 + j, true); |
192 RaiseWindowWidget(w, 8 + j); |
196 w->RaiseWidget(8 + j); |
193 w->widget[8 + j].data = SPR_IMG_ARROW_NE_WHITE + j; //reset arrows to white |
197 w->widget[8 + j].data = SPR_IMG_ARROW_NE_WHITE + j; //reset arrows to white |
194 } |
198 } |
195 |
199 |
196 if (_airport.station_type != 0xFF) { |
200 if (_airport.station_type != 0xFF) { |
197 int x = fsmportspec->size_x[_airport.layout_set]; |
201 int x = fsmportspec->size_x[_airport.layout_set]; |
263 |
267 |
264 case WE_CLICK: { |
268 case WE_CLICK: { |
265 switch (e->we.click.widget) { |
269 switch (e->we.click.widget) { |
266 case 12: case 13: |
270 case 12: case 13: |
267 _station_show_coverage = (e->we.click.widget != 12); |
271 _station_show_coverage = (e->we.click.widget != 12); |
268 SetWindowWidgetLoweredState(w, 12, !_station_show_coverage); |
272 w->SetWidgetLoweredState(12, !_station_show_coverage); |
269 SetWindowWidgetLoweredState(w, 13, _station_show_coverage); |
273 w->SetWidgetLoweredState(13, _station_show_coverage); |
270 SndPlayFx(SND_15_BEEP); |
274 SndPlayFx(SND_15_BEEP); |
271 SetWindowDirty(w); |
275 SetWindowDirty(w); |
272 break; |
276 break; |
273 case 3: |
277 case 3: |
274 case 4: |
278 case 4: |
316 _airport.layout_set = j; |
320 _airport.layout_set = j; |
317 break; |
321 break; |
318 } |
322 } |
319 } |
323 } |
320 |
324 |
321 SetWindowWidgetLoweredState(w, 8, (_airport.direction == DIR_NE)); |
325 w->SetWidgetLoweredState( 8, (_airport.direction == DIR_NE)); |
322 SetWindowWidgetLoweredState(w, 9, (_airport.direction == DIR_SE)); |
326 w->SetWidgetLoweredState( 9, (_airport.direction == DIR_SE)); |
323 SetWindowWidgetLoweredState(w, 10, (_airport.direction == DIR_SW)); |
327 w->SetWidgetLoweredState(10, (_airport.direction == DIR_SW)); |
324 SetWindowWidgetLoweredState(w, 11, (_airport.direction == DIR_NW)); |
328 w->SetWidgetLoweredState(11, (_airport.direction == DIR_NW)); |
325 SndPlayFx(SND_15_BEEP); |
329 SndPlayFx(SND_15_BEEP); |
326 SetWindowDirty(w); |
330 SetWindowDirty(w); |
327 break; |
331 break; |
328 } |
332 } |
329 } break; |
333 } break; |