2005-07-24 16:12:37 +02:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 17:11:33 +02:00
|
|
|
/** @file vehicle_gui.h Functions related to the vehicle's GUIs. */
|
2007-04-04 06:08:47 +02:00
|
|
|
|
2004-09-06 20:15:13 +02:00
|
|
|
#ifndef VEHICLE_GUI_H
|
|
|
|
#define VEHICLE_GUI_H
|
|
|
|
|
2008-05-17 15:01:30 +02:00
|
|
|
#include "window_type.h"
|
2007-12-27 14:35:39 +01:00
|
|
|
#include "vehicle_type.h"
|
2008-03-28 17:36:32 +01:00
|
|
|
#include "order_type.h"
|
2008-03-28 17:33:28 +01:00
|
|
|
#include "station_type.h"
|
2008-03-28 19:00:38 +01:00
|
|
|
#include "engine_type.h"
|
2008-08-20 03:29:05 +02:00
|
|
|
#include "waypoint.h"
|
2005-05-03 01:59:11 +02:00
|
|
|
|
2005-09-18 22:56:44 +02:00
|
|
|
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
|
2008-09-24 18:40:06 +02:00
|
|
|
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent);
|
2004-09-06 20:15:13 +02:00
|
|
|
|
2008-01-18 14:02:47 +01:00
|
|
|
/** Constants of vehicle view widget indices */
|
|
|
|
enum VehicleViewWindowWidgets {
|
|
|
|
VVW_WIDGET_CLOSEBOX = 0,
|
|
|
|
VVW_WIDGET_CAPTION,
|
|
|
|
VVW_WIDGET_STICKY,
|
|
|
|
VVW_WIDGET_PANEL,
|
|
|
|
VVW_WIDGET_VIEWPORT,
|
|
|
|
VVW_WIDGET_START_STOP_VEH,
|
|
|
|
VVW_WIDGET_CENTER_MAIN_VIEH,
|
|
|
|
VVW_WIDGET_GOTO_DEPOT,
|
|
|
|
VVW_WIDGET_REFIT_VEH,
|
|
|
|
VVW_WIDGET_SHOW_ORDERS,
|
|
|
|
VVW_WIDGET_SHOW_DETAILS,
|
|
|
|
VVW_WIDGET_CLONE_VEH,
|
|
|
|
VVW_WIDGET_EMPTY_BOTTOM_RIGHT,
|
|
|
|
VVW_WIDGET_RESIZE,
|
|
|
|
VVW_WIDGET_TURN_AROUND,
|
|
|
|
VVW_WIDGET_FORCE_PROCEED,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Vehicle List Window type flags */
|
2006-08-29 23:36:39 +02:00
|
|
|
enum {
|
2006-09-04 17:16:58 +02:00
|
|
|
VLW_STANDARD = 0 << 8,
|
2006-08-29 23:36:39 +02:00
|
|
|
VLW_SHARED_ORDERS = 1 << 8,
|
|
|
|
VLW_STATION_LIST = 2 << 8,
|
2006-09-30 15:39:34 +02:00
|
|
|
VLW_DEPOT_LIST = 3 << 8,
|
2007-05-19 11:40:18 +02:00
|
|
|
VLW_GROUP_LIST = 4 << 8,
|
2008-08-21 03:42:21 +02:00
|
|
|
VLW_WAYPOINT_LIST = 5 << 8,
|
2006-09-04 17:16:58 +02:00
|
|
|
VLW_MASK = 0x700,
|
2006-08-29 23:36:39 +02:00
|
|
|
};
|
|
|
|
|
2006-09-01 12:24:15 +02:00
|
|
|
static inline bool ValidVLWFlags(uint16 flags)
|
|
|
|
{
|
2007-05-19 11:40:18 +02:00
|
|
|
return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST);
|
2006-09-01 12:24:15 +02:00
|
|
|
}
|
|
|
|
|
2007-03-26 13:41:14 +02:00
|
|
|
int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
|
2005-01-02 18:23:04 +01:00
|
|
|
|
2007-12-27 14:35:39 +01:00
|
|
|
void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip);
|
|
|
|
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count);
|
2006-08-29 19:41:13 +02:00
|
|
|
void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection);
|
2006-09-04 01:27:38 +02:00
|
|
|
void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
|
2006-08-29 19:41:13 +02:00
|
|
|
|
2007-05-18 19:31:41 +02:00
|
|
|
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
|
2006-08-29 19:41:13 +02:00
|
|
|
|
2006-10-23 23:39:15 +02:00
|
|
|
uint ShowAdditionalText(int x, int y, uint w, EngineID engine);
|
|
|
|
uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine);
|
2005-10-24 21:40:48 +02:00
|
|
|
|
2007-01-21 01:01:47 +01:00
|
|
|
void ShowVehicleListWindow(const Vehicle *v);
|
2008-08-20 03:29:05 +02:00
|
|
|
void ShowVehicleListWindow(const Waypoint *wp);
|
2008-09-30 22:39:50 +02:00
|
|
|
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type);
|
|
|
|
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station);
|
|
|
|
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile);
|
2006-09-29 01:05:03 +02:00
|
|
|
|
2008-04-27 20:05:48 +02:00
|
|
|
|
|
|
|
/* ChangeVehicleViewWindow() moves all windows for one vehicle to another vehicle.
|
|
|
|
* For ease of use it can be called with both Vehicle pointers and VehicleIDs. */
|
|
|
|
void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index);
|
|
|
|
|
2007-05-18 19:31:41 +02:00
|
|
|
static inline uint GetVehicleListHeight(VehicleType type)
|
2006-10-10 12:04:09 +02:00
|
|
|
{
|
2007-03-08 17:27:54 +01:00
|
|
|
return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
|
2006-10-10 12:04:09 +02:00
|
|
|
}
|
|
|
|
|
2008-04-24 11:55:20 +02:00
|
|
|
/** Get WindowClass for vehicle list of given vehicle type
|
|
|
|
* @param vt vehicle type to check
|
|
|
|
* @return corresponding window class
|
2008-09-30 22:39:50 +02:00
|
|
|
* @note works only for company buildable vehicle types
|
2008-04-24 11:55:20 +02:00
|
|
|
*/
|
|
|
|
static inline WindowClass GetWindowClassForVehicleType(VehicleType vt)
|
|
|
|
{
|
|
|
|
switch (vt) {
|
|
|
|
default: NOT_REACHED();
|
|
|
|
case VEH_TRAIN: return WC_TRAINS_LIST;
|
|
|
|
case VEH_ROAD: return WC_ROADVEH_LIST;
|
|
|
|
case VEH_SHIP: return WC_SHIPS_LIST;
|
|
|
|
case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-29 22:50:58 +02:00
|
|
|
/* Unified window procedure */
|
|
|
|
void ShowVehicleViewWindow(const Vehicle *v);
|
|
|
|
|
2008-05-11 16:23:45 +02:00
|
|
|
Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y);
|
|
|
|
|
2004-09-06 20:15:13 +02:00
|
|
|
#endif /* VEHICLE_GUI_H */
|