vehicle_gui.h
author bjarni
Sun, 02 Jan 2005 17:23:04 +0000
changeset 842 ebfd36603ab9
parent 588 1b60458bdc29
child 1093 e8d26c7dc42f
permissions -rw-r--r--
(svn r1323) Adding autoreplace feature
This feature works much like autorenew, but it will get you a new engine type instead of a new one of the same type. Once
ordered, it will automatically replace the engines while they visits a depot. The GUI for setting this up have been added on the
vehicle overview windows
Note: autorenew is now autoreplace, but to the same engine type
Nice new features, that was added to make this possible
- windows can now have two independant vertical scrollbars
- CMD_SHOW_NO_ERROR have been added as a flag for DoCommandP. It will make it do the action instead of showing the red box with
estimated costs even if shift is pressed
- fixed problem where enginetypes where not initialized when loading a game. It's now done in InitializeGame()
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
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
     4
struct vehiclelist_d;
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
     5
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
     6
void DrawVehicleProfitButton(Vehicle *v, int x, int y);
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
     7
void InitializeVehiclesGuiList();
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
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
     9
/* sorter stuff */
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    10
void RebuildVehicleLists(void);
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    11
void ResortVehicleLists(void);
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    12
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    13
void BuildVehicleList(struct vehiclelist_d *vl, int type, int owner, int station);
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    14
void SortVehicleList(struct vehiclelist_d *vl);
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 505
diff changeset
    15
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
    16
typedef struct SortStruct { // store owner through sorting process
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
    17
	uint32	index;
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
    18
	byte		owner;
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
    19
} SortStruct;
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
int CDECL GeneralOwnerSorter(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
    22
void VehicleSorter(SortStruct *firstelement, uint32 n, uint16 size);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    23
VARDEF uint32	_internal_name_sorter_id;	// internal StringID for default vehicle-names
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    24
VARDEF uint32	_last_vehicle_idx;				// cached index to hopefully speed up name-sorting
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    25
VARDEF bool		_internal_sort_order;			// descending/ascending
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
    26
168
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    27
#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
    28
#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
    29
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    30
DEF_SORTER(VehicleUnsortedSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    31
DEF_SORTER(VehicleNumberSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    32
DEF_SORTER(VehicleNameSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    33
DEF_SORTER(VehicleAgeSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    34
DEF_SORTER(VehicleProfitThisYearSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    35
DEF_SORTER(VehicleProfitLastYearSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    36
DEF_SORTER(VehicleCargoSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    37
DEF_SORTER(VehicleReliabilitySorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    38
DEF_SORTER(VehicleMaxSpeedSorter);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    39
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    40
typedef DEF_SORTER(VehicleSortListingTypeFunctions);
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    41
79f9ed5b23e6 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents: 164
diff changeset
    42
#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
    43
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
    44
extern const StringID _vehicle_sort_listing[];
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    45
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
    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
enum VehicleSortTypes {
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
    48
	VEHTRAIN		= 0,
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
    49
	VEHROAD			= 1,
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
    50
	VEHSHIP			= 2,
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    51
	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
    52
};
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
    53
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
    54
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
    55
  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
    56
	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
    57
  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
    58
};
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
    59
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    60
void ShowReplaceVehicleWindow(byte vehicletype);
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    61
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    62
void Set_DPARAM_Train_Engine_Build_Window(uint16 engine_number);
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    63
void Set_DPARAM_Train_Car_Build_Window(Window *w, uint16 engine_number);
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    64
void Set_DPARAM_Road_Veh_Build_Window(uint16 engine_number);
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    65
void Set_DPARAM_Aircraft_Build_Window(uint16 engine_number);
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    66
void Set_DPARAM_Ship_Build_Window(uint16 engine_number);
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    67
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 588
diff changeset
    68
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
    69
#endif /* VEHICLE_GUI_H */