OpenTTD
vehicle_gui.h
Go to the documentation of this file.
1 /* $Id: vehicle_gui.h 24839 2012-12-23 01:00:25Z michi_cc $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef VEHICLE_GUI_H
13 #define VEHICLE_GUI_H
14 
15 #include "window_type.h"
16 #include "vehicle_type.h"
17 #include "order_type.h"
18 #include "station_type.h"
19 #include "engine_type.h"
20 #include "company_type.h"
21 
22 void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit = false);
23 
30 };
31 
38 };
39 
40 int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number);
41 
42 void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip, VehicleID drag_dest = INVALID_VEHICLE);
43 void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip = 0);
44 void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type);
45 void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type);
46 
47 void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
48 
49 uint ShowRefitOptionsList(int left, int right, int y, EngineID engine);
51 
52 void ShowVehicleListWindow(const Vehicle *v);
53 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type);
54 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station);
55 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile);
56 
62 static inline uint GetVehicleHeight(VehicleType type)
63 {
64  return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
65 }
66 
67 int GetVehicleWidth(Vehicle *v, EngineImageType image_type);
68 
71  uint height;
72  uint extend_left;
73  uint extend_right;
74 };
75 
77 
85 {
86  switch (vt) {
87  default: NOT_REACHED();
88  case VEH_TRAIN: return WC_TRAINS_LIST;
89  case VEH_ROAD: return WC_ROADVEH_LIST;
90  case VEH_SHIP: return WC_SHIPS_LIST;
91  case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST;
92  }
93 }
94 
95 /* Unified window procedure */
96 void ShowVehicleViewWindow(const Vehicle *v);
97 bool VehicleClicked(const Vehicle *v);
98 void StartStopVehicle(const Vehicle *v, bool texteffect);
99 
100 Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y);
101 
102 void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip);
103 
104 #endif /* VEHICLE_GUI_H */