229 } |
229 } |
230 } |
230 } |
231 |
231 |
232 static const Widget _player_stations_widgets[] = { |
232 static const Widget _player_stations_widgets[] = { |
233 { WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
233 { WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
234 { WWT_CAPTION, 14, 11, 357, 0, 13, STR_3048_STATIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
234 { WWT_CAPTION, 14, 11, 345, 0, 13, STR_3048_STATIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
235 { WWT_STICKYBOX, 14, 346, 357, 0, 13, 0x0, STR_STICKY_BUTTON}, |
235 { WWT_PANEL, 14, 0, 346, 14, 137, 0x0, STR_3057_STATION_NAMES_CLICK_ON}, |
236 { WWT_PANEL, 14, 0, 346, 14, 137, 0x0, STR_3057_STATION_NAMES_CLICK_ON}, |
236 { WWT_SCROLLBAR, 14, 347, 357, 14, 137, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
237 { WWT_SCROLLBAR, 14, 347, 357, 14, 137, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
237 { WIDGETS_END}, |
238 { WIDGETS_END}, |
238 }; |
239 }; |
239 |
240 |
240 static const WindowDesc _player_stations_desc = { |
241 static const WindowDesc _player_stations_desc = { |
241 -1, -1, 358, 138, |
242 -1, -1, 358, 138, |
242 WC_STATION_LIST,0, |
243 WC_STATION_LIST,0, |
243 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
244 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
244 _player_stations_widgets, |
245 _player_stations_widgets, |
245 PlayerStationsWndProc |
246 PlayerStationsWndProc |
246 }; |
247 }; |
247 |
248 |
248 |
249 |
257 } |
258 } |
258 } |
259 } |
259 |
260 |
260 static const Widget _station_view_expanded_widgets[] = { |
261 static const Widget _station_view_expanded_widgets[] = { |
261 { WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
262 { WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
262 { WWT_CAPTION, 14, 11, 248, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
263 { WWT_CAPTION, 14, 11, 236, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
264 { WWT_STICKYBOX, 14, 237, 248, 0, 13, 0x0, STR_STICKY_BUTTON}, |
263 { WWT_IMGBTN, 14, 0, 237, 14, 65, 0x0, STR_NULL}, |
265 { WWT_IMGBTN, 14, 0, 237, 14, 65, 0x0, STR_NULL}, |
264 { WWT_SCROLLBAR, 14, 238, 248, 14, 65, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
266 { WWT_SCROLLBAR, 14, 238, 248, 14, 65, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
265 { WWT_EMPTY, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
267 { WWT_EMPTY, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
266 { WWT_IMGBTN, 14, 0, 248, 66, 197, 0x0, STR_NULL}, |
268 { WWT_IMGBTN, 14, 0, 248, 66, 197, 0x0, STR_NULL}, |
267 { WWT_PUSHTXTBTN, 14, 0, 63, 198, 209, STR_00E4_LOCATION, STR_3053_CENTER_MAIN_VIEW_ON_STATION}, |
269 { WWT_PUSHTXTBTN, 14, 0, 63, 198, 209, STR_00E4_LOCATION, STR_3053_CENTER_MAIN_VIEW_ON_STATION}, |
274 { WIDGETS_END}, |
276 { WIDGETS_END}, |
275 }; |
277 }; |
276 |
278 |
277 static const Widget _station_view_widgets[] = { |
279 static const Widget _station_view_widgets[] = { |
278 { WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
280 { WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
279 { WWT_CAPTION, 14, 11, 248, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
281 { WWT_CAPTION, 14, 11, 236, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
282 { WWT_STICKYBOX, 14, 237, 248, 0, 13, 0x0, STR_STICKY_BUTTON}, |
280 { WWT_IMGBTN, 14, 0, 237, 14, 65, 0x0, STR_NULL}, |
283 { WWT_IMGBTN, 14, 0, 237, 14, 65, 0x0, STR_NULL}, |
281 { WWT_SCROLLBAR, 14, 238, 248, 14, 65, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
284 { WWT_SCROLLBAR, 14, 238, 248, 14, 65, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
282 { WWT_IMGBTN, 14, 0, 248, 66, 97, 0x0, STR_NULL}, |
285 { WWT_IMGBTN, 14, 0, 248, 66, 97, 0x0, STR_NULL}, |
283 { WWT_EMPTY, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
286 { WWT_EMPTY, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
284 { WWT_PUSHTXTBTN, 14, 0, 63, 98, 109, STR_00E4_LOCATION, STR_3053_CENTER_MAIN_VIEW_ON_STATION}, |
287 { WWT_PUSHTXTBTN, 14, 0, 63, 98, 109, STR_00E4_LOCATION, STR_3053_CENTER_MAIN_VIEW_ON_STATION}, |
315 num++; |
318 num++; |
316 } |
319 } |
317 } |
320 } |
318 SetVScrollCount(w, num); |
321 SetVScrollCount(w, num); |
319 |
322 |
320 w->disabled_state = st->owner == _local_player ? 0 : (1 << 8); |
323 w->disabled_state = st->owner == _local_player ? 0 : (1 << 9); |
321 |
324 |
322 if (!(st->facilities & FACIL_TRAIN)) SETBIT(w->disabled_state, 9); |
325 if (!(st->facilities & FACIL_TRAIN)) SETBIT(w->disabled_state, 10); |
323 if (!(st->facilities & FACIL_TRUCK_STOP) && |
326 if (!(st->facilities & FACIL_TRUCK_STOP) && |
324 !(st->facilities & FACIL_BUS_STOP)) SETBIT(w->disabled_state, 10); |
327 !(st->facilities & FACIL_BUS_STOP)) SETBIT(w->disabled_state, 11); |
325 if (!(st->facilities & FACIL_AIRPORT)) SETBIT(w->disabled_state, 11); |
328 if (!(st->facilities & FACIL_AIRPORT)) SETBIT(w->disabled_state, 12); |
326 if (!(st->facilities & FACIL_DOCK)) SETBIT(w->disabled_state, 12); |
329 if (!(st->facilities & FACIL_DOCK)) SETBIT(w->disabled_state, 13); |
327 |
330 |
328 SetDParam(0, st->index); |
331 SetDParam(0, st->index); |
329 SetDParam(1, st->facilities); |
332 SetDParam(1, st->facilities); |
330 DrawWindowWidgets(w); |
333 DrawWindowWidgets(w); |
331 |
334 |
436 DrawStationViewWindow(w); |
439 DrawStationViewWindow(w); |
437 break; |
440 break; |
438 |
441 |
439 case WE_CLICK: |
442 case WE_CLICK: |
440 switch(e->click.widget) { |
443 switch(e->click.widget) { |
441 case 6: |
444 case 7: |
442 ScrollMainWindowToTile(DEREF_STATION(w->window_number)->xy); |
445 ScrollMainWindowToTile(DEREF_STATION(w->window_number)->xy); |
443 break; |
446 break; |
444 |
447 |
445 case 7: |
448 case 8: |
446 SetWindowDirty(w); |
449 SetWindowDirty(w); |
447 |
450 |
448 /* toggle height/widget set */ |
451 /* toggle height/widget set */ |
449 w->height ^= (210 ^ 110); |
452 w->height ^= (210 ^ 110); |
450 *(uint32*)&w->widget ^= (uint32)_station_view_expanded_widgets ^ (uint32)_station_view_widgets; |
453 *(uint32*)&w->widget ^= (uint32)_station_view_expanded_widgets ^ (uint32)_station_view_widgets; |
451 |
454 |
452 SetWindowDirty(w); |
455 SetWindowDirty(w); |
453 break; |
456 break; |
454 |
457 |
455 case 8: { |
458 case 9: { |
456 Station *st = DEREF_STATION(w->window_number); |
459 Station *st = DEREF_STATION(w->window_number); |
457 SetDParam(0, st->town->townnametype); |
460 SetDParam(0, st->town->townnametype); |
458 SetDParam(1, st->town->townnameparts); |
461 SetDParam(1, st->town->townnameparts); |
459 ShowQueryString(st->string_id, STR_3030_RENAME_STATION_LOADING, 31, 180, w->window_class, w->window_number); |
462 ShowQueryString(st->string_id, STR_3030_RENAME_STATION_LOADING, 31, 180, w->window_class, w->window_number); |
460 } break; |
463 } break; |
461 |
464 |
462 case 9: { |
465 case 10: { |
463 const Station *st = DEREF_STATION(w->window_number); |
466 const Station *st = DEREF_STATION(w->window_number); |
464 ShowPlayerTrains(st->owner, w->window_number); |
467 ShowPlayerTrains(st->owner, w->window_number); |
465 break; |
468 break; |
466 } |
469 } |
467 |
470 |
468 case 10: { |
471 case 11: { |
469 const Station *st = DEREF_STATION(w->window_number); |
472 const Station *st = DEREF_STATION(w->window_number); |
470 ShowPlayerRoadVehicles(st->owner, w->window_number); |
473 ShowPlayerRoadVehicles(st->owner, w->window_number); |
471 break; |
474 break; |
472 } |
475 } |
473 |
476 |
474 case 11: { |
477 case 12: { |
475 const Station *st = DEREF_STATION(w->window_number); |
478 const Station *st = DEREF_STATION(w->window_number); |
476 ShowPlayerAircraft(st->owner, w->window_number); |
479 ShowPlayerAircraft(st->owner, w->window_number); |
477 break; |
480 break; |
478 } |
481 } |
479 |
482 |
480 case 12: { |
483 case 13: { |
481 const Station *st = DEREF_STATION(w->window_number); |
484 const Station *st = DEREF_STATION(w->window_number); |
482 ShowPlayerShips(st->owner, w->window_number); |
485 ShowPlayerShips(st->owner, w->window_number); |
483 break; |
486 break; |
484 } |
487 } |
485 } |
488 } |