vehicle_gui.h

Go to the documentation of this file.
00001 /* $Id: vehicle_gui.h 23735 2012-01-03 20:26:05Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef VEHICLE_GUI_H
00013 #define VEHICLE_GUI_H
00014 
00015 #include "window_type.h"
00016 #include "vehicle_type.h"
00017 #include "order_type.h"
00018 #include "station_type.h"
00019 #include "engine_type.h"
00020 #include "company_type.h"
00021 
00022 void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit = false);
00023 
00025 enum TrainDetailsWindowTabs {
00026   TDW_TAB_CARGO = 0, 
00027   TDW_TAB_INFO,      
00028   TDW_TAB_CAPACITY,  
00029   TDW_TAB_TOTALS,    
00030 };
00031 
00032 int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number);
00033 
00034 void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip, VehicleID drag_dest = INVALID_VEHICLE);
00035 void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip = 0);
00036 void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type);
00037 void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type);
00038 
00039 void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
00040 
00041 uint ShowRefitOptionsList(int left, int right, int y, EngineID engine);
00042 StringID GetCargoSubtypeText(const Vehicle *v);
00043 
00044 void ShowVehicleListWindow(const Vehicle *v);
00045 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type);
00046 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station);
00047 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile);
00048 
00054 static inline uint GetVehicleHeight(VehicleType type)
00055 {
00056   return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
00057 }
00058 
00059 int GetVehicleWidth(Vehicle *v, EngineImageType image_type);
00060 
00067 static inline WindowClass GetWindowClassForVehicleType(VehicleType vt)
00068 {
00069   switch (vt) {
00070     default: NOT_REACHED();
00071     case VEH_TRAIN:    return WC_TRAINS_LIST;
00072     case VEH_ROAD:     return WC_ROADVEH_LIST;
00073     case VEH_SHIP:     return WC_SHIPS_LIST;
00074     case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST;
00075   }
00076 }
00077 
00078 /* Unified window procedure */
00079 void ShowVehicleViewWindow(const Vehicle *v);
00080 bool VehicleClicked(const Vehicle *v);
00081 void StartStopVehicle(const Vehicle *v, bool texteffect);
00082 
00083 Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y);
00084 
00085 void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip);
00086 
00087 #endif /* VEHICLE_GUI_H */