2004-09-06 18:15:13 +00:00
|
|
|
#ifndef VEHICLE_GUI_H
|
|
|
|
#define VEHICLE_GUI_H
|
|
|
|
|
2004-12-10 18:16:08 +00:00
|
|
|
struct vehiclelist_d;
|
|
|
|
|
2004-09-06 18:15:13 +00:00
|
|
|
void DrawVehicleProfitButton(Vehicle *v, int x, int y);
|
2005-01-22 20:23:18 +00:00
|
|
|
void InitializeVehiclesGuiList(void);
|
2004-09-06 18:15:13 +00:00
|
|
|
|
|
|
|
/* sorter stuff */
|
2004-12-10 18:16:08 +00:00
|
|
|
void RebuildVehicleLists(void);
|
|
|
|
void ResortVehicleLists(void);
|
|
|
|
|
|
|
|
void BuildVehicleList(struct vehiclelist_d *vl, int type, int owner, int station);
|
|
|
|
void SortVehicleList(struct vehiclelist_d *vl);
|
|
|
|
|
2004-09-06 18:15:13 +00:00
|
|
|
typedef struct SortStruct { // store owner through sorting process
|
|
|
|
uint32 index;
|
|
|
|
byte owner;
|
|
|
|
} SortStruct;
|
|
|
|
|
2004-09-06 21:20:01 +00:00
|
|
|
int CDECL GeneralOwnerSorter(const void *a, const void *b);
|
|
|
|
void VehicleSorter(SortStruct *firstelement, uint32 n, uint16 size);
|
|
|
|
VARDEF uint32 _internal_name_sorter_id; // internal StringID for default vehicle-names
|
|
|
|
VARDEF uint32 _last_vehicle_idx; // cached index to hopefully speed up name-sorting
|
|
|
|
VARDEF bool _internal_sort_order; // descending/ascending
|
|
|
|
|
2004-09-06 18:15:13 +00:00
|
|
|
#define PERIODIC_RESORT_DAYS 10
|
2004-09-06 21:20:01 +00:00
|
|
|
#define DEF_SORTER(yyyy) int CDECL yyyy(const void *a, const void *b)
|
|
|
|
|
|
|
|
DEF_SORTER(VehicleUnsortedSorter);
|
|
|
|
DEF_SORTER(VehicleNumberSorter);
|
|
|
|
DEF_SORTER(VehicleNameSorter);
|
|
|
|
DEF_SORTER(VehicleAgeSorter);
|
|
|
|
DEF_SORTER(VehicleProfitThisYearSorter);
|
|
|
|
DEF_SORTER(VehicleProfitLastYearSorter);
|
|
|
|
DEF_SORTER(VehicleCargoSorter);
|
|
|
|
DEF_SORTER(VehicleReliabilitySorter);
|
|
|
|
DEF_SORTER(VehicleMaxSpeedSorter);
|
2004-09-06 18:15:13 +00:00
|
|
|
|
2004-09-06 21:20:01 +00:00
|
|
|
typedef DEF_SORTER(VehicleSortListingTypeFunctions);
|
|
|
|
|
|
|
|
#define SORT_BY_UNSORTED 0
|
2004-11-25 06:05:47 +00:00
|
|
|
extern VehicleSortListingTypeFunctions * const _vehicle_sorter[];
|
|
|
|
extern const StringID _vehicle_sort_listing[];
|
2005-01-02 17:23:04 +00:00
|
|
|
extern const StringID _rail_types_list[];
|
2004-09-06 18:15:13 +00:00
|
|
|
|
|
|
|
enum VehicleSortTypes {
|
|
|
|
VEHTRAIN = 0,
|
|
|
|
VEHROAD = 1,
|
|
|
|
VEHSHIP = 2,
|
2005-01-02 17:23:04 +00:00
|
|
|
VEHAIRCRAFT = 3
|
2004-09-06 18:15:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
|
|
|
|
PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
|
|
|
|
PLY_WND_PRC__SIZE_OF_ROW_BIG = 36,
|
|
|
|
};
|
|
|
|
|
2005-01-02 17:23:04 +00:00
|
|
|
void ShowReplaceVehicleWindow(byte vehicletype);
|
|
|
|
|
|
|
|
void Set_DPARAM_Train_Engine_Build_Window(uint16 engine_number);
|
|
|
|
void Set_DPARAM_Train_Car_Build_Window(Window *w, uint16 engine_number);
|
|
|
|
void Set_DPARAM_Road_Veh_Build_Window(uint16 engine_number);
|
|
|
|
void Set_DPARAM_Aircraft_Build_Window(uint16 engine_number);
|
|
|
|
void Set_DPARAM_Ship_Build_Window(uint16 engine_number);
|
|
|
|
|
|
|
|
|
2004-09-06 18:15:13 +00:00
|
|
|
#endif /* VEHICLE_GUI_H */
|