vehicle_gui.h

Go to the documentation of this file.
00001 /* $Id: vehicle_gui.h 18809 2010-01-15 16:41:15Z 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);
00023 
00025 enum VehicleViewWindowWidgets {
00026   VVW_WIDGET_CAPTION,
00027   VVW_WIDGET_VIEWPORT,           
00028   VVW_WIDGET_START_STOP_VEH,
00029   VVW_WIDGET_CENTER_MAIN_VIEH,
00030   VVW_WIDGET_GOTO_DEPOT,
00031   VVW_WIDGET_REFIT_VEH,
00032   VVW_WIDGET_SHOW_ORDERS,
00033   VVW_WIDGET_SHOW_DETAILS,
00034   VVW_WIDGET_CLONE_VEH,
00035   VVW_WIDGET_SELECT_DEPOT_CLONE, 
00036   VVW_WIDGET_SELECT_REFIT_TURN,  
00037   VVW_WIDGET_TURN_AROUND,
00038   VVW_WIDGET_FORCE_PROCEED,
00039 };
00040 
00042 enum TrainDetailsWindowTabs {
00043   TDW_TAB_CARGO = 0, 
00044   TDW_TAB_INFO,      
00045   TDW_TAB_CAPACITY,  
00046   TDW_TAB_TOTALS,    
00047 };
00048 
00050 enum {
00051   VLW_STANDARD      = 0 << 8,
00052   VLW_SHARED_ORDERS = 1 << 8,
00053   VLW_STATION_LIST  = 2 << 8,
00054   VLW_DEPOT_LIST    = 3 << 8,
00055   VLW_GROUP_LIST    = 4 << 8,
00056   VLW_WAYPOINT_LIST = 5 << 8,
00057   VLW_MASK          = 0x700,
00058 };
00059 
00060 static inline bool ValidVLWFlags(uint16 flags)
00061 {
00062   return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST);
00063 }
00064 
00065 int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number);
00066 
00067 void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID selection, int skip);
00068 void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
00069 void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
00070 void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
00071 
00072 void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
00073 
00074 uint ShowRefitOptionsList(int left, int right, int y, EngineID engine);
00075 StringID GetCargoSubtypeText(const Vehicle *v);
00076 
00077 void ShowVehicleListWindow(const Vehicle *v);
00078 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, const Waypoint *wp);
00079 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type);
00080 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station);
00081 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile);
00082 
00088 static inline uint GetVehicleHeight(VehicleType type)
00089 {
00090   return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
00091 }
00092 
00098 static inline WindowClass GetWindowClassForVehicleType(VehicleType vt)
00099 {
00100   switch (vt) {
00101     default: NOT_REACHED();
00102     case VEH_TRAIN:    return WC_TRAINS_LIST;
00103     case VEH_ROAD:     return WC_ROADVEH_LIST;
00104     case VEH_SHIP:     return WC_SHIPS_LIST;
00105     case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST;
00106   }
00107 }
00108 
00109 /* Unified window procedure */
00110 void ShowVehicleViewWindow(const Vehicle *v);
00111 
00112 Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y);
00113 
00114 #endif /* VEHICLE_GUI_H */

Generated on Wed Mar 31 22:43:31 2010 for OpenTTD by  doxygen 1.6.1