vehicle_gui.h
author tron
Thu, 21 Jul 2005 22:15:02 +0000
changeset 2159 3b634157c3b2
parent 1907 cebdef7a1c8a
child 2186 461a2aff3486
permissions -rw-r--r--
(svn r2669) Shuffle some more stuff around to reduce dependencies
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
     1
#ifndef VEHICLE_GUI_H
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
     2
#define VEHICLE_GUI_H
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
     3
1752
cdbfb2f23e72 (svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
matthijs
parents: 1246
diff changeset
     4
#include "vehicle.h"
cdbfb2f23e72 (svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
matthijs
parents: 1246
diff changeset
     5
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
     6
struct vehiclelist_d;
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
     7
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
     8
void DrawVehicleProfitButton(Vehicle *v, int x, int y);
1802
448f187042d3 (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents: 1763
diff changeset
     9
CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 842
diff changeset
    10
void InitializeVehiclesGuiList(void);
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    11
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    12
/* sorter stuff */
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    13
void RebuildVehicleLists(void);
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    14
void ResortVehicleLists(void);
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    15
1763
9e6f367ae02e (svn r2267) - Codechange: Reverted the typedeffing of VehicleType (r2256), since that interfered with the saveload code.
matthijs
parents: 1752
diff changeset
    16
void BuildVehicleList(struct vehiclelist_d *vl, int type, int owner, int station);
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    17
void SortVehicleList(struct vehiclelist_d *vl);
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    18
168
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    19
int CDECL GeneralOwnerSorter(const void *a, const void *b);
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    20
168
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    21
#define PERIODIC_RESORT_DAYS 10
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    22
#define DEF_SORTER(yyyy) int CDECL yyyy(const void *a, const void *b)
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    23
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    24
DEF_SORTER(VehicleUnsortedSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    25
DEF_SORTER(VehicleNumberSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    26
DEF_SORTER(VehicleNameSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    27
DEF_SORTER(VehicleAgeSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    28
DEF_SORTER(VehicleProfitThisYearSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    29
DEF_SORTER(VehicleProfitLastYearSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    30
DEF_SORTER(VehicleCargoSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    31
DEF_SORTER(VehicleReliabilitySorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    32
DEF_SORTER(VehicleMaxSpeedSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    33
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    34
typedef DEF_SORTER(VehicleSortListingTypeFunctions);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    35
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    36
#define SORT_BY_UNSORTED 0
505
11582dcada49 (svn r813) Push two tables from vehicle_gui.h into vehicle_gui.c - they were in the binary 48 (!) times.
tron
parents: 168
diff changeset
    37
extern VehicleSortListingTypeFunctions * const _vehicle_sorter[];
11582dcada49 (svn r813) Push two tables from vehicle_gui.h into vehicle_gui.c - they were in the binary 48 (!) times.
tron
parents: 168
diff changeset
    38
extern const StringID _vehicle_sort_listing[];
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    39
extern const StringID _rail_types_list[];
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    40
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    41
enum VehicleSortTypes {
1246
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    42
	VEHTRAIN     = 0,
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    43
	VEHROAD      = 1,
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    44
	VEHSHIP      = 2,
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    45
	VEHAIRCRAFT  = 3
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    46
};
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    47
1246
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    48
typedef struct Listing {
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    49
	bool order;	// Ascending/descending?
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    50
	byte criteria;	// Sorting criteria
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    51
} Listing;
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    52
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    53
typedef struct Sorting {
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    54
	Listing aircraft;
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    55
	Listing roadveh;
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    56
	Listing ship;
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    57
	Listing train;
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    58
} Sorting;
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    59
2159
3b634157c3b2 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 1907
diff changeset
    60
extern Sorting _sorting;
1246
45f15251412b (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
darkvater
parents: 1093
diff changeset
    61
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    62
enum {
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    63
  PLY_WND_PRC__OFFSET_TOP_WIDGET	= 26,
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    64
	PLY_WND_PRC__SIZE_OF_ROW_SMALL	= 26,
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    65
  PLY_WND_PRC__SIZE_OF_ROW_BIG		= 36,
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    66
};
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    67
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    68
void ShowReplaceVehicleWindow(byte vehicletype);
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    69
1907
cebdef7a1c8a (svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents: 1802
diff changeset
    70
void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number);
cebdef7a1c8a (svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents: 1802
diff changeset
    71
void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number);
cebdef7a1c8a (svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents: 1802
diff changeset
    72
void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number);
cebdef7a1c8a (svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents: 1802
diff changeset
    73
void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number);
cebdef7a1c8a (svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents: 1802
diff changeset
    74
void DrawShipPurchaseInfo(int x, int y, EngineID engine_number);
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    75
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    76
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
    77
#endif /* VEHICLE_GUI_H */