2005-07-24 15:12:37 +01:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-04-04 05:08:47 +01:00
|
|
|
/** @file vehicle_gui.h */
|
|
|
|
|
2004-09-06 19:15:13 +01:00
|
|
|
#ifndef VEHICLE_GUI_H
|
|
|
|
#define VEHICLE_GUI_H
|
|
|
|
|
2007-12-19 19:44:29 +00:00
|
|
|
#include "window_gui.h"
|
2007-12-27 13:35:39 +00:00
|
|
|
#include "vehicle_type.h"
|
2008-03-28 16:36:32 +00:00
|
|
|
#include "order_type.h"
|
2008-03-28 16:33:28 +00:00
|
|
|
#include "station_type.h"
|
2008-03-28 18:00:38 +00:00
|
|
|
#include "engine_type.h"
|
2005-05-03 00:59:11 +01:00
|
|
|
|
2005-09-18 21:56:44 +01:00
|
|
|
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
|
2006-10-03 15:52:39 +01:00
|
|
|
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order);
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeVehiclesGuiList();
|
2004-09-06 19:15:13 +01:00
|
|
|
|
|
|
|
/* sorter stuff */
|
2007-03-07 11:47:46 +00:00
|
|
|
void RebuildVehicleLists();
|
|
|
|
void ResortVehicleLists();
|
2007-05-19 10:40:18 +01:00
|
|
|
void SortVehicleList(vehiclelist_d *vl);
|
|
|
|
void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type);
|
2004-12-10 18:16:08 +00:00
|
|
|
|
2004-09-06 19:15:13 +01:00
|
|
|
#define PERIODIC_RESORT_DAYS 10
|
|
|
|
|
2007-05-19 10:40:18 +01:00
|
|
|
extern const StringID _vehicle_sort_listing[];
|
|
|
|
|
2008-01-18 13:02:47 +00: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,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Start of functions regarding vehicle list windows */
|
2007-05-19 10:40:18 +01:00
|
|
|
enum {
|
|
|
|
PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
|
|
|
|
PLY_WND_PRC__SIZE_OF_ROW_TINY = 13,
|
|
|
|
PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
|
|
|
|
PLY_WND_PRC__SIZE_OF_ROW_BIG = 36,
|
|
|
|
PLY_WND_PRC__SIZE_OF_ROW_BIG2 = 39,
|
|
|
|
};
|
|
|
|
|
2008-01-18 13:02:47 +00:00
|
|
|
/** Vehicle List Window type flags */
|
2006-08-29 22:36:39 +01:00
|
|
|
enum {
|
2006-09-04 16:16:58 +01:00
|
|
|
VLW_STANDARD = 0 << 8,
|
2006-08-29 22:36:39 +01:00
|
|
|
VLW_SHARED_ORDERS = 1 << 8,
|
|
|
|
VLW_STATION_LIST = 2 << 8,
|
2006-09-30 14:39:34 +01:00
|
|
|
VLW_DEPOT_LIST = 3 << 8,
|
2007-05-19 10:40:18 +01:00
|
|
|
VLW_GROUP_LIST = 4 << 8,
|
2006-09-04 16:16:58 +01:00
|
|
|
VLW_MASK = 0x700,
|
2006-08-29 22:36:39 +01:00
|
|
|
};
|
|
|
|
|
2006-09-01 11:24:15 +01:00
|
|
|
static inline bool ValidVLWFlags(uint16 flags)
|
|
|
|
{
|
2007-05-19 10:40:18 +01:00
|
|
|
return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST);
|
2006-09-01 11:24:15 +01:00
|
|
|
}
|
|
|
|
|
2006-08-29 18:41:13 +01:00
|
|
|
void PlayerVehWndProc(Window *w, WindowEvent *e);
|
|
|
|
|
2007-03-26 12:41:14 +01:00
|
|
|
int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
|
2005-01-02 17:23:04 +00:00
|
|
|
|
2007-12-27 13:35:39 +00: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 18:41:13 +01:00
|
|
|
void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection);
|
2006-09-04 00:27:38 +01:00
|
|
|
void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
|
2006-08-29 18:41:13 +01:00
|
|
|
|
2007-05-18 18:31:41 +01:00
|
|
|
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
|
2006-08-29 18:41:13 +01:00
|
|
|
|
2005-10-24 20:40:48 +01:00
|
|
|
void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v);
|
|
|
|
|
2006-10-23 22:39:15 +01:00
|
|
|
uint ShowAdditionalText(int x, int y, uint w, EngineID engine);
|
|
|
|
uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine);
|
2005-10-24 20:40:48 +01:00
|
|
|
|
2007-01-21 00:01:47 +00:00
|
|
|
void ShowVehicleListWindow(const Vehicle *v);
|
2007-05-18 18:31:41 +01:00
|
|
|
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type);
|
|
|
|
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, StationID station);
|
|
|
|
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, TileIndex depot_tile);
|
2006-09-29 00:05:03 +01:00
|
|
|
|
2007-05-19 10:40:18 +01:00
|
|
|
void DrawSmallOrderList(const Vehicle *v, int x, int y);
|
2006-10-05 09:15:51 +01:00
|
|
|
|
2007-12-27 13:35:39 +00:00
|
|
|
void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip);
|
2006-10-05 09:15:51 +01:00
|
|
|
|
2007-05-18 18:31:41 +01:00
|
|
|
static inline uint GetVehicleListHeight(VehicleType type)
|
2006-10-10 11:04:09 +01:00
|
|
|
{
|
2007-03-08 16:27:54 +00:00
|
|
|
return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
|
2006-10-10 11:04:09 +01:00
|
|
|
}
|
|
|
|
|
2008-04-24 10:55:20 +01:00
|
|
|
/** Get WindowClass for vehicle list of given vehicle type
|
|
|
|
* @param vt vehicle type to check
|
|
|
|
* @return corresponding window class
|
|
|
|
* @note works only for player buildable vehicle types
|
|
|
|
*/
|
|
|
|
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 21:50:58 +01:00
|
|
|
/* Unified window procedure */
|
|
|
|
void ShowVehicleViewWindow(const Vehicle *v);
|
|
|
|
|
2008-03-28 16:38:18 +00:00
|
|
|
Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y);
|
|
|
|
|
2004-09-06 19:15:13 +01:00
|
|
|
#endif /* VEHICLE_GUI_H */
|