src/vehicle_gui.h
branchgamebalance
changeset 9911 0b8b245a2391
parent 9908 0fa543611bbe
child 9912 1ac8aac92385
equal deleted inserted replaced
9910:0b2aebc8283e 9911:0b8b245a2391
    13 void InitializeVehiclesGuiList();
    13 void InitializeVehiclesGuiList();
    14 
    14 
    15 /* sorter stuff */
    15 /* sorter stuff */
    16 void RebuildVehicleLists();
    16 void RebuildVehicleLists();
    17 void ResortVehicleLists();
    17 void ResortVehicleLists();
       
    18 void SortVehicleList(vehiclelist_d *vl);
       
    19 void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type);
    18 
    20 
    19 #define PERIODIC_RESORT_DAYS 10
    21 #define PERIODIC_RESORT_DAYS 10
       
    22 
       
    23 extern const StringID _vehicle_sort_listing[];
       
    24 
       
    25 /* Start of functions regarding vehicle list windows */
       
    26 enum {
       
    27 	PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
       
    28 	PLY_WND_PRC__SIZE_OF_ROW_TINY  = 13,
       
    29 	PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
       
    30 	PLY_WND_PRC__SIZE_OF_ROW_BIG   = 36,
       
    31 	PLY_WND_PRC__SIZE_OF_ROW_BIG2  = 39,
       
    32 };
    20 
    33 
    21 /* Vehicle List Window type flags */
    34 /* Vehicle List Window type flags */
    22 enum {
    35 enum {
    23 	VLW_STANDARD      = 0 << 8,
    36 	VLW_STANDARD      = 0 << 8,
    24 	VLW_SHARED_ORDERS = 1 << 8,
    37 	VLW_SHARED_ORDERS = 1 << 8,
    25 	VLW_STATION_LIST  = 2 << 8,
    38 	VLW_STATION_LIST  = 2 << 8,
    26 	VLW_DEPOT_LIST    = 3 << 8,
    39 	VLW_DEPOT_LIST    = 3 << 8,
       
    40 	VLW_GROUP_LIST    = 4 << 8,
    27 	VLW_MASK          = 0x700,
    41 	VLW_MASK          = 0x700,
    28 };
    42 };
    29 
    43 
    30 static inline bool ValidVLWFlags(uint16 flags)
    44 static inline bool ValidVLWFlags(uint16 flags)
    31 {
    45 {
    32 	return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST);
    46 	return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST);
    33 }
    47 }
    34 
    48 
    35 void PlayerVehWndProc(Window *w, WindowEvent *e);
    49 void PlayerVehWndProc(Window *w, WindowEvent *e);
    36 
    50 
    37 int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
    51 int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
    39 void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection);
    53 void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection);
    40 void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection);
    54 void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection);
    41 void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection);
    55 void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection);
    42 void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
    56 void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
    43 
    57 
    44 void ShowBuildVehicleWindow(TileIndex tile, byte type);
    58 void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
    45 
    59 
    46 void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v);
    60 void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v);
    47 
    61 
    48 uint ShowAdditionalText(int x, int y, uint w, EngineID engine);
    62 uint ShowAdditionalText(int x, int y, uint w, EngineID engine);
    49 uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine);
    63 uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine);
    50 
    64 
    51 void ShowVehicleListWindow(const Vehicle *v);
    65 void ShowVehicleListWindow(const Vehicle *v);
    52 void ShowVehicleListWindow(PlayerID player, byte vehicle_type);
    66 void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type);
    53 void ShowVehicleListWindow(PlayerID player, byte vehicle_type, StationID station);
    67 void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, StationID station);
    54 void ShowVehicleListWindow(PlayerID player, byte vehicle_type, TileIndex depot_tile);
    68 void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, TileIndex depot_tile);
    55 
    69 
    56 void ShowReplaceVehicleWindow(byte vehicletype);
    70 void ShowReplaceVehicleWindow(VehicleType vehicletype);
       
    71 void DrawSmallOrderList(const Vehicle *v, int x, int y);
       
    72 void ShowReplaceGroupVehicleWindow(GroupID group, VehicleType veh);
    57 
    73 
    58 static inline void DrawVehicleImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection)
    74 static inline void DrawVehicleImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection)
    59 {
    75 {
    60 	switch (v->type) {
    76 	switch (v->type) {
    61 		case VEH_TRAIN:    DrawTrainImage(v, x, y, count, skip, selection); break;
    77 		case VEH_TRAIN:    DrawTrainImage(v, x, y, count, skip, selection); break;
    64 		case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection);           break;
    80 		case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection);           break;
    65 		default: NOT_REACHED();
    81 		default: NOT_REACHED();
    66 	}
    82 	}
    67 }
    83 }
    68 
    84 
    69 static inline uint GetVehicleListHeight(byte type)
    85 static inline uint GetVehicleListHeight(VehicleType type)
    70 {
    86 {
    71 	return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
    87 	return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
    72 }
    88 }
    73 
    89 
    74 #endif /* VEHICLE_GUI_H */
    90 #endif /* VEHICLE_GUI_H */