diff options
author | bjarni <bjarni@openttd.org> | 2006-09-28 23:05:03 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-09-28 23:05:03 +0000 |
commit | 4ccdb0686f3b401199efc975e8ce9f75bbcde0d7 (patch) | |
tree | b9c5f2fcf23245015608eafaccdf02f62b94eda6 /ship_gui.c | |
parent | 1ae8aa4b809c3ddff032e2f3de7317490efa5235 (diff) | |
download | openttd-4ccdb0686f3b401199efc975e8ce9f75bbcde0d7.tar.xz |
(svn r6562) -Codechange: merged the vehicle list window widget arrays
It made no sense to maintain 8 nearly identically arrays when a single one can do the job
Also made the two buttons always use half of the bottom width each, even when resizing
Diffstat (limited to 'ship_gui.c')
-rw-r--r-- | ship_gui.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/ship_gui.c b/ship_gui.c index 8d80d9a48..bf1114d1c 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -548,80 +548,3 @@ void DrawSmallOrderListShip(const Vehicle *v, int x, int y) } } } - - -static const Widget _player_ships_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 247, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_LR, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, -{ WWT_PANEL, RESIZE_NONE, 14, 81, 235, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, -{ WWT_TEXTBTN, RESIZE_NONE, 14, 236, 247, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, -{ WWT_PANEL, RESIZE_RIGHT, 14, 248, 259, 14, 25, 0x0, STR_NULL}, -{ WWT_MATRIX, RESIZE_RB, 14, 0, 247, 26, 169, 0x401, STR_9823_SHIPS_CLICK_ON_SHIP_FOR}, -{ WWT_SCROLLBAR, RESIZE_LRB, 14, 248, 259, 26, 169, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 124, 170, 181, STR_SEND_TO_DEPOTS, STR_SEND_TO_DEPOTS_TIP}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 125, 247, 170, 181, STR_REPLACE_VEHICLES, STR_REPLACE_HELP}, -{ WWT_PANEL, RESIZE_RTB, 14, 248, 247, 170, 181, 0x0, STR_NULL}, -{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 248, 259, 170, 181, 0x0, STR_RESIZE_BUTTON}, -{ WIDGETS_END}, -}; - -static const Widget _other_player_ships_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 247, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_LR, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, -{ WWT_PANEL, RESIZE_NONE, 14, 81, 235, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, -{ WWT_TEXTBTN, RESIZE_NONE, 14, 236, 247, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, -{ WWT_PANEL, RESIZE_RIGHT, 14, 248, 259, 14, 25, 0x0, STR_NULL}, -{ WWT_MATRIX, RESIZE_RB, 14, 0, 247, 26, 169, 0x401, STR_9823_SHIPS_CLICK_ON_SHIP_FOR}, -{ WWT_SCROLLBAR, RESIZE_LRB, 14, 248, 259, 26, 169, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_PANEL, RESIZE_RTB, 14, 0, 247, 170, 181, 0x0, STR_NULL}, -{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 248, 259, 170, 181, 0x0, STR_RESIZE_BUTTON}, -{ WIDGETS_END}, -}; - -static const WindowDesc _player_ships_desc = { - -1, -1, 260, 182, - WC_SHIPS_LIST,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, - _player_ships_widgets, - PlayerVehWndProc -}; - -static const WindowDesc _other_player_ships_desc = { - -1, -1, 260, 182, - WC_SHIPS_LIST,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, - _other_player_ships_widgets, - PlayerVehWndProc -}; - - -static void ShowPlayerShipsLocal(PlayerID player, StationID station, OrderID order, bool show_shared) -{ - Window *w; - - if (show_shared) { - w = AllocateWindowDescFront(&_player_ships_desc, (order << 16) | (VEH_Ship << 11) | VLW_SHARED_ORDERS | player); - } else { - uint16 VLW_flag = (station == INVALID_STATION) ? VLW_STANDARD : VLW_STATION_LIST; - if (player == _local_player) { - w = AllocateWindowDescFront(&_player_ships_desc, (station << 16) | (VEH_Ship << 11) | VLW_flag | player); - } else { - w = AllocateWindowDescFront(&_other_player_ships_desc, (station << 16) | (VEH_Ship << 11) | VLW_flag | player); - } - } -} - -void ShowPlayerShips(PlayerID player, StationID station) -{ - ShowPlayerShipsLocal(player, station, 0, false); -} - -void ShowVehWithSharedOrdersShips(Vehicle *v) -{ - if (v->orders == NULL) return; // no shared list to show - ShowPlayerShipsLocal(v->owner, INVALID_STATION, v->orders->index, true); -} |