533 } else { |
533 } else { |
534 w->caption_color = _local_player; |
534 w->caption_color = _local_player; |
535 } |
535 } |
536 } |
536 } |
537 |
537 |
538 static const Widget _player_roadveh_widgets[] = { |
|
539 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
540 { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 247, 0, 13, STR_9001_ROAD_VEHICLES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
541 { WWT_STICKYBOX, RESIZE_LR, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, |
|
542 { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, |
|
543 { WWT_PANEL, RESIZE_NONE, 14, 81, 235, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, |
|
544 { WWT_TEXTBTN, RESIZE_NONE, 14, 236, 247, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, |
|
545 { WWT_PANEL, RESIZE_RIGHT, 14, 248, 259, 14, 25, 0x0, STR_NULL}, |
|
546 { WWT_MATRIX, RESIZE_RB, 14, 0, 247, 26, 207, 0x701, STR_901A_ROAD_VEHICLES_CLICK_ON}, |
|
547 { WWT_SCROLLBAR, RESIZE_LRB, 14, 248, 259, 26, 207, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
|
548 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 124, 208, 219, STR_SEND_TO_DEPOTS, STR_SEND_TO_DEPOTS_TIP}, |
|
549 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 125, 247, 208, 219, STR_REPLACE_VEHICLES, STR_REPLACE_HELP}, |
|
550 { WWT_PANEL, RESIZE_RTB, 14, 248, 247, 208, 219, 0x0, STR_NULL}, |
|
551 { WWT_RESIZEBOX, RESIZE_LRTB, 14, 248, 259, 208, 219, 0x0, STR_RESIZE_BUTTON}, |
|
552 { WIDGETS_END}, |
|
553 }; |
|
554 |
|
555 static const Widget _other_player_roadveh_widgets[] = { |
|
556 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
557 { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 247, 0, 13, STR_9001_ROAD_VEHICLES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
558 { WWT_STICKYBOX, RESIZE_LR, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, |
|
559 { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, |
|
560 { WWT_PANEL, RESIZE_NONE, 14, 81, 235, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, |
|
561 { WWT_TEXTBTN, RESIZE_NONE, 14, 236, 247, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, |
|
562 { WWT_PANEL, RESIZE_RIGHT, 14, 248, 259, 14, 25, 0x0, STR_NULL}, |
|
563 { WWT_MATRIX, RESIZE_RB, 14, 0, 247, 26, 207, 0x701, STR_901A_ROAD_VEHICLES_CLICK_ON}, |
|
564 { WWT_SCROLLBAR, RESIZE_LRB, 14, 248, 259, 26, 207, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
|
565 { WWT_PANEL, RESIZE_RTB, 14, 0, 247, 208, 219, 0x0, STR_NULL}, |
|
566 { WWT_RESIZEBOX, RESIZE_LRTB, 14, 248, 259, 208, 219, 0x0, STR_RESIZE_BUTTON}, |
|
567 { WIDGETS_END}, |
|
568 }; |
|
569 |
|
570 static const WindowDesc _player_roadveh_desc = { |
|
571 -1, -1, 260, 220, |
|
572 WC_ROADVEH_LIST,0, |
|
573 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
|
574 _player_roadveh_widgets, |
|
575 PlayerVehWndProc |
|
576 }; |
|
577 |
|
578 static const WindowDesc _other_player_roadveh_desc = { |
|
579 -1, -1, 260, 220, |
|
580 WC_ROADVEH_LIST,0, |
|
581 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
|
582 _other_player_roadveh_widgets, |
|
583 PlayerVehWndProc |
|
584 }; |
|
585 |
|
586 |
|
587 static void ShowPlayerRoadVehiclesLocal(PlayerID player, StationID station, OrderID order, bool show_shared) |
|
588 { |
|
589 Window *w; |
|
590 |
|
591 if (show_shared) { |
|
592 w = AllocateWindowDescFront(&_player_roadveh_desc, (order << 16) | (VEH_Road << 11) | VLW_SHARED_ORDERS | player); |
|
593 } else { |
|
594 uint16 VLW_flag = (station == INVALID_STATION) ? VLW_STANDARD : VLW_STATION_LIST; |
|
595 if (player == _local_player) { |
|
596 w = AllocateWindowDescFront(&_player_roadveh_desc, (station << 16) | (VEH_Road << 11) | VLW_flag | player); |
|
597 } else { |
|
598 w = AllocateWindowDescFront(&_other_player_roadveh_desc, (station << 16) | (VEH_Road << 11) | VLW_flag | player); |
|
599 } |
|
600 } |
|
601 } |
|
602 |
|
603 void ShowPlayerRoadVehicles(PlayerID player, StationID station) |
|
604 { |
|
605 ShowPlayerRoadVehiclesLocal(player, station, 0, false); |
|
606 } |
|
607 |
|
608 void ShowVehWithSharedOrdersRoadVehicles(Vehicle *v) |
|
609 { |
|
610 if (v->orders == NULL) return; // no shared list to show |
|
611 ShowPlayerRoadVehiclesLocal(v->owner, INVALID_STATION, v->orders->index, true); |
|
612 } |
|