src/vehicle_gui.h
changeset 5475 2e6990a8c7c4
parent 4932 4bf213d0ed53
child 5745 c8069ea3af5d
equal deleted inserted replaced
5474:ac55aefc54f3 5475:2e6990a8c7c4
       
     1 /* $Id$ */
       
     2 
       
     3 #ifndef VEHICLE_GUI_H
       
     4 #define VEHICLE_GUI_H
       
     5 
       
     6 #include "window.h"
       
     7 #include "vehicle.h"
       
     8 
       
     9 void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
       
    10 void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order);
       
    11 void InitializeVehiclesGuiList(void);
       
    12 
       
    13 /* sorter stuff */
       
    14 void RebuildVehicleLists(void);
       
    15 void ResortVehicleLists(void);
       
    16 
       
    17 #define PERIODIC_RESORT_DAYS 10
       
    18 
       
    19 /* Vehicle List Window type flags */
       
    20 enum {
       
    21 	VLW_STANDARD      = 0 << 8,
       
    22 	VLW_SHARED_ORDERS = 1 << 8,
       
    23 	VLW_STATION_LIST  = 2 << 8,
       
    24 	VLW_DEPOT_LIST    = 3 << 8,
       
    25 	VLW_MASK          = 0x700,
       
    26 };
       
    27 
       
    28 static inline bool ValidVLWFlags(uint16 flags)
       
    29 {
       
    30 	return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST);
       
    31 }
       
    32 
       
    33 void PlayerVehWndProc(Window *w, WindowEvent *e);
       
    34 
       
    35 void DrawTrainEnginePurchaseInfo(int x, int y, uint w, EngineID engine_number);
       
    36 void DrawTrainWagonPurchaseInfo(int x, int y, uint w, EngineID engine_number);
       
    37 void DrawRoadVehPurchaseInfo(int x, int y, uint w, EngineID engine_number);
       
    38 void DrawAircraftPurchaseInfo(int x, int y, uint w, EngineID engine_number);
       
    39 void DrawShipPurchaseInfo(int x, int y, uint w, EngineID engine_number);
       
    40 
       
    41 void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection);
       
    42 void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection);
       
    43 void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection);
       
    44 void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
       
    45 
       
    46 void ShowBuildTrainWindow(TileIndex tile);
       
    47 void ShowBuildRoadVehWindow(TileIndex tile);
       
    48 void ShowBuildShipWindow(TileIndex tile);
       
    49 void ShowBuildVehicleWindow(TileIndex tile, byte type);
       
    50 
       
    51 void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v);
       
    52 
       
    53 uint ShowAdditionalText(int x, int y, uint w, EngineID engine);
       
    54 uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine);
       
    55 
       
    56 void ShowVehicleListWindow(PlayerID player, StationID station, byte vehicle_type);
       
    57 void ShowVehWithSharedOrders(Vehicle *v, byte vehicle_type);
       
    58 void ShowVehDepotOrders(PlayerID player, byte vehicle_type, TileIndex depot_tile);
       
    59 
       
    60 
       
    61 static inline void DrawVehicleImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection)
       
    62 {
       
    63 	switch (v->type) {
       
    64 		case VEH_Train:    DrawTrainImage(v, x, y, count, skip, selection); break;
       
    65 		case VEH_Road:     DrawRoadVehImage(v, x, y, selection);            break;
       
    66 		case VEH_Ship:     DrawShipImage(v, x, y, selection);               break;
       
    67 		case VEH_Aircraft: DrawAircraftImage(v, x, y, selection);           break;
       
    68 		default: NOT_REACHED();
       
    69 	}
       
    70 }
       
    71 
       
    72 static inline byte GetVehicleListHeight(byte type)
       
    73 {
       
    74 	return (type == VEH_Train || type == VEH_Road) ? 14 : 24;
       
    75 }
       
    76 
       
    77 #endif /* VEHICLE_GUI_H */